diff --git a/README.md b/README.md index f033a3cd8f90ba0764b6bb75a36e8bd67d1e72d4..000ff26bd1d50bbc28834ea9a798b7f1ae5158cc 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,14 @@ tags: - multi-agent - message-board size_categories: -- n<1K +- 1K dict[str, str]: def check_generator() -> None: with tempfile.TemporaryDirectory() as d: - g.generate(Path(d)) - check(files(Path(d)) == files(HERE), "generate.py does not reproduce the committed files") + root = Path(d) + g.generate(root) + check(files(root) == files(HERE), "generate.py does not reproduce the committed files") + seed = g.SEED + 1 + g.generate(root, seed=seed) + tasks = sorted((root / "tasks").glob("*/task.toml")) + check(len(tasks) == 1568, "alternate seed did not generate 1,568 task.toml files") + for task in tasks: + check(re.findall(r"^seed = (.+)$", task.read_text(), re.MULTILINE) == [str(seed)], + f"{task.parent.name}: task.toml does not record the alternate seed {seed}") drawn = g.problems() check(drawn == g.problems(), "the same seed gave other problems") check(drawn != g.problems(g.SEED + 1), "another seed gave the same problems") check(len(drawn) == 32 and all(len(p) == 16 and all(type(x) is int and 1 <= x <= 99 for x in p) for p in drawn), "not 32 problems of 16 integers in 1..99") + check(g.SIZES == (1, 2, 4, 6, 8, 12, 16), "team sizes do not match the evaluation grid") check(all(read_words(g.words(n)) == n for n in range(1, 100)) and len({g.words(n) for n in range(1, 100)}) == 99, "the English words are wrong") names = [] @@ -206,6 +217,17 @@ def oracle(task: Path) -> int: return grade(task, path.read_bytes()) +def check_reward_symlink(task: Path) -> None: + def setup(root: Path) -> None: + answer = root / "app" / "answer.json" + shutil.copyfile(task / "tests" / "expected.json", answer) + verifier = root / "verifier" + verifier.mkdir() + (verifier / "reward.txt").symlink_to(answer) + + check(grade(task, cheat=setup) == 1, f"{task.name}: preexisting reward symlink clobbered the answer") + + def wrong_answers(team: list[int]) -> dict[str, list]: """The answers that must score 0 for a team (sorted): those that apply to it.""" last = team[-1] + 1 if team[-1] < 99 else team[-1] - 1 @@ -307,6 +329,7 @@ def check_graders() -> dict[str, int]: check(oracle(task) == 1, f"{task.name}: the oracle does not score 1") cases = {k: (json.dumps(v).encode(), None) for k, v in wrong_answers(team).items()} if task.name.startswith("agg-p01-"): + check_reward_symlink(task) cases |= {k: (v, None) for k, v in malformed(team).items()} cases |= {k: (None, cheat) for k, cheat in cheats(task).items()} for case, (answer, cheat) in cases.items(): diff --git a/generate.py b/generate.py index 45bdd6f94f80a021e1e3367c2e989e3108455b9c..e697e2acfea729dd78dfdd5f3d25a428552bbb20 100644 --- a/generate.py +++ b/generate.py @@ -19,7 +19,7 @@ from pathlib import Path SEED = 115 # huggingface/legion#115 PROBLEMS = 32 # the paper's held-out set size NUMBERS = 16 # per problem; a team of N holds the first N -SIZES = (1, 2, 4, 8, 16) +SIZES = (1, 2, 4, 6, 8, 12, 16) LOW, HIGH = 1, 99 IMAGE = "python:3.12-slim" # public and prebuilt: HF Sandboxes need one, docker and podman too @@ -56,6 +56,8 @@ def task_name(problem: int, n: int, slot: int) -> str: def instruction(n: int, number: int) -> str: + submission = """`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately.""" if n == 1: return f"""# Sort the team's private numbers @@ -65,7 +67,11 @@ hold one private integer from 1 to 99, written in English words. Your private number is {words(number)}. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +{submission} +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. """ return f"""# Sort the team's private numbers @@ -84,14 +90,17 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the {n} integers, as digits, in ascending order. - Then stop. + +{submission} +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. """ -def task_toml(problem: int, n: int, slot: int) -> str: +def task_toml(problem: int, n: int, slot: int, seed: int = SEED) -> str: return f"""schema_version = "1.4" [task] @@ -104,7 +113,7 @@ keywords = ["multi-agent", "message-board", "s3", "aggregation"] problem = {problem} agents = {n} slot = {slot} -seed = {SEED} +seed = {seed} [agent] timeout_sec = 1800 @@ -141,7 +150,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os @@ -240,7 +249,7 @@ def generate(root: Path = HERE, seed: int = SEED) -> None: for slot, number in enumerate(team, 1): task = root / "tasks" / task_name(p, n, slot) write(task / "instruction.md", instruction(n, number)) - write(task / "task.toml", task_toml(p, n, slot)) + write(task / "task.toml", task_toml(p, n, slot, seed)) write(task / "tests" / "test.sh", TEST_SH, 0o755) write(task / "tests" / "expected.json", json.dumps(sorted(team)) + "\n") write(task / "solution" / "solve.sh", solve_sh(sorted(team)), 0o755) diff --git a/tasks/agg-p01-n01-s01/instruction.md b/tasks/agg-p01-n01-s01/instruction.md index 8b183a410f6784b4c2401e33f3404029ba45b663..cfe0a5390fb2b6a15328ff2764e870f0aedbbb24 100644 --- a/tasks/agg-p01-n01-s01/instruction.md +++ b/tasks/agg-p01-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is thirty-seven. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p01-n01-s01/tests/test.sh b/tasks/agg-p01-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n01-s01/tests/test.sh +++ b/tasks/agg-p01-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n02-s01/instruction.md b/tasks/agg-p01-n02-s01/instruction.md index a0f5d6312615f15532c609835c393db0d12fe574..60942ac5c12598ab8f5115caa263a4e08a18a959 100644 --- a/tasks/agg-p01-n02-s01/instruction.md +++ b/tasks/agg-p01-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n02-s01/tests/test.sh b/tasks/agg-p01-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n02-s01/tests/test.sh +++ b/tasks/agg-p01-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n02-s02/instruction.md b/tasks/agg-p01-n02-s02/instruction.md index 167173925a58f43421fe956da0f01ef01e301397..92a4b343d6cb438777ea12b8e26917b19a933458 100644 --- a/tasks/agg-p01-n02-s02/instruction.md +++ b/tasks/agg-p01-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n02-s02/tests/test.sh b/tasks/agg-p01-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n02-s02/tests/test.sh +++ b/tasks/agg-p01-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n04-s01/instruction.md b/tasks/agg-p01-n04-s01/instruction.md index e277410d31e98e54fee347c8344a718ced81e639..a341ab49f244ade6a8766079f432438a2111a896 100644 --- a/tasks/agg-p01-n04-s01/instruction.md +++ b/tasks/agg-p01-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n04-s01/tests/test.sh b/tasks/agg-p01-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n04-s01/tests/test.sh +++ b/tasks/agg-p01-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n04-s02/instruction.md b/tasks/agg-p01-n04-s02/instruction.md index b8bf8bb7f338bebb4f1b4bb8e9a1d6897951e665..75940058facf064c83e54bfafb24d694c01c6b3a 100644 --- a/tasks/agg-p01-n04-s02/instruction.md +++ b/tasks/agg-p01-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n04-s02/tests/test.sh b/tasks/agg-p01-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n04-s02/tests/test.sh +++ b/tasks/agg-p01-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n04-s03/instruction.md b/tasks/agg-p01-n04-s03/instruction.md index 861fe1fef00423e5f645a688c63a473579cf4cf3..fced5a4a6107d08d8b6fe321f29fc874df759613 100644 --- a/tasks/agg-p01-n04-s03/instruction.md +++ b/tasks/agg-p01-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n04-s03/tests/test.sh b/tasks/agg-p01-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n04-s03/tests/test.sh +++ b/tasks/agg-p01-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n04-s04/instruction.md b/tasks/agg-p01-n04-s04/instruction.md index 189ef04e2f40301a08ddef437dba11e2c4d3907a..fd7c3cf4ddc29ed0b8aeb3aa0b4ffd3b2fea0ec5 100644 --- a/tasks/agg-p01-n04-s04/instruction.md +++ b/tasks/agg-p01-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n04-s04/tests/test.sh b/tasks/agg-p01-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n04-s04/tests/test.sh +++ b/tasks/agg-p01-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n06-s01/instruction.md b/tasks/agg-p01-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b24b39ec78a0cf7e450c5ad8eba4aa7d5a4a5b36 --- /dev/null +++ b/tasks/agg-p01-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n06-s01/solution/solve.sh b/tasks/agg-p01-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..468ff69149e23146a5679c9d4b6048c16e1b188b --- /dev/null +++ b/tasks/agg-p01-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 43, 69]' > "$answer" diff --git a/tasks/agg-p01-n06-s01/task.toml b/tasks/agg-p01-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9e54bf47c29c750eb217bf055d94c8cedfc23a4c --- /dev/null +++ b/tasks/agg-p01-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n06-s01/tests/expected.json b/tasks/agg-p01-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0d6c8ffec7b71aeb9d2c1178737568829a9229c7 --- /dev/null +++ b/tasks/agg-p01-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 43, 69] diff --git a/tasks/agg-p01-n06-s01/tests/test.sh b/tasks/agg-p01-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n06-s02/instruction.md b/tasks/agg-p01-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1af6734da6c2b1564d7c972fd4d9f0f79b16b317 --- /dev/null +++ b/tasks/agg-p01-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n06-s02/solution/solve.sh b/tasks/agg-p01-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..468ff69149e23146a5679c9d4b6048c16e1b188b --- /dev/null +++ b/tasks/agg-p01-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 43, 69]' > "$answer" diff --git a/tasks/agg-p01-n06-s02/task.toml b/tasks/agg-p01-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2d6822949c3fabce2b160a8102117ccadbe37049 --- /dev/null +++ b/tasks/agg-p01-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n06-s02/tests/expected.json b/tasks/agg-p01-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0d6c8ffec7b71aeb9d2c1178737568829a9229c7 --- /dev/null +++ b/tasks/agg-p01-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 43, 69] diff --git a/tasks/agg-p01-n06-s02/tests/test.sh b/tasks/agg-p01-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n06-s03/instruction.md b/tasks/agg-p01-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..dc81e7d9c7fcb605ef3de973a2527bf92800a8d5 --- /dev/null +++ b/tasks/agg-p01-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifteen. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n06-s03/solution/solve.sh b/tasks/agg-p01-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..468ff69149e23146a5679c9d4b6048c16e1b188b --- /dev/null +++ b/tasks/agg-p01-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 43, 69]' > "$answer" diff --git a/tasks/agg-p01-n06-s03/task.toml b/tasks/agg-p01-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..254cfaacc9481bd18d5f48f9c75530dd2044b1df --- /dev/null +++ b/tasks/agg-p01-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n06-s03/tests/expected.json b/tasks/agg-p01-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0d6c8ffec7b71aeb9d2c1178737568829a9229c7 --- /dev/null +++ b/tasks/agg-p01-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 43, 69] diff --git a/tasks/agg-p01-n06-s03/tests/test.sh b/tasks/agg-p01-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n06-s04/instruction.md b/tasks/agg-p01-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1ae5701228c0785276a3840ea6979f720367dde7 --- /dev/null +++ b/tasks/agg-p01-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n06-s04/solution/solve.sh b/tasks/agg-p01-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..468ff69149e23146a5679c9d4b6048c16e1b188b --- /dev/null +++ b/tasks/agg-p01-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 43, 69]' > "$answer" diff --git a/tasks/agg-p01-n06-s04/task.toml b/tasks/agg-p01-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2eb3f487d739dbb12c773058bd405099a29e407e --- /dev/null +++ b/tasks/agg-p01-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n06-s04/tests/expected.json b/tasks/agg-p01-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0d6c8ffec7b71aeb9d2c1178737568829a9229c7 --- /dev/null +++ b/tasks/agg-p01-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 43, 69] diff --git a/tasks/agg-p01-n06-s04/tests/test.sh b/tasks/agg-p01-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n06-s05/instruction.md b/tasks/agg-p01-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..dc81e7d9c7fcb605ef3de973a2527bf92800a8d5 --- /dev/null +++ b/tasks/agg-p01-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifteen. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n06-s05/solution/solve.sh b/tasks/agg-p01-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..468ff69149e23146a5679c9d4b6048c16e1b188b --- /dev/null +++ b/tasks/agg-p01-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 43, 69]' > "$answer" diff --git a/tasks/agg-p01-n06-s05/task.toml b/tasks/agg-p01-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..951cf75e54dbfeae55137fee0d87f1366f45a90e --- /dev/null +++ b/tasks/agg-p01-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n06-s05/tests/expected.json b/tasks/agg-p01-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0d6c8ffec7b71aeb9d2c1178737568829a9229c7 --- /dev/null +++ b/tasks/agg-p01-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 43, 69] diff --git a/tasks/agg-p01-n06-s05/tests/test.sh b/tasks/agg-p01-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n06-s06/instruction.md b/tasks/agg-p01-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bc2345670eef592df5089b3576aa387d4b4f7ef0 --- /dev/null +++ b/tasks/agg-p01-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n06-s06/solution/solve.sh b/tasks/agg-p01-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..468ff69149e23146a5679c9d4b6048c16e1b188b --- /dev/null +++ b/tasks/agg-p01-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 43, 69]' > "$answer" diff --git a/tasks/agg-p01-n06-s06/task.toml b/tasks/agg-p01-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2957cf52706d36f6ca954ff5cebf1b19abf44552 --- /dev/null +++ b/tasks/agg-p01-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n06-s06/tests/expected.json b/tasks/agg-p01-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0d6c8ffec7b71aeb9d2c1178737568829a9229c7 --- /dev/null +++ b/tasks/agg-p01-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 43, 69] diff --git a/tasks/agg-p01-n06-s06/tests/test.sh b/tasks/agg-p01-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n08-s01/instruction.md b/tasks/agg-p01-n08-s01/instruction.md index d28771240990d9554944b9ef68d9203e0acd7f13..99290acfb8baa2927750e2841040ecf9ddb5f1fa 100644 --- a/tasks/agg-p01-n08-s01/instruction.md +++ b/tasks/agg-p01-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n08-s01/tests/test.sh b/tasks/agg-p01-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n08-s01/tests/test.sh +++ b/tasks/agg-p01-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n08-s02/instruction.md b/tasks/agg-p01-n08-s02/instruction.md index 23b58906ee0667ea87049330a38e00438d4f14de..74e668bf3b4713b512ae0c1a24b6253ddea36c40 100644 --- a/tasks/agg-p01-n08-s02/instruction.md +++ b/tasks/agg-p01-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n08-s02/tests/test.sh b/tasks/agg-p01-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n08-s02/tests/test.sh +++ b/tasks/agg-p01-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n08-s03/instruction.md b/tasks/agg-p01-n08-s03/instruction.md index 27a8e1bd50be0cdbb7d7c6e5b7370ea7a88e7623..1e33aeee51a9a4d728e4588929a0d66b9457a8bb 100644 --- a/tasks/agg-p01-n08-s03/instruction.md +++ b/tasks/agg-p01-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n08-s03/tests/test.sh b/tasks/agg-p01-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n08-s03/tests/test.sh +++ b/tasks/agg-p01-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n08-s04/instruction.md b/tasks/agg-p01-n08-s04/instruction.md index cfd28188a178a5f820bd132665deb26a6bb181c9..4ecbeb7af5580eb469b9bc54604d3613b27a96ef 100644 --- a/tasks/agg-p01-n08-s04/instruction.md +++ b/tasks/agg-p01-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n08-s04/tests/test.sh b/tasks/agg-p01-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n08-s04/tests/test.sh +++ b/tasks/agg-p01-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n08-s05/instruction.md b/tasks/agg-p01-n08-s05/instruction.md index 27a8e1bd50be0cdbb7d7c6e5b7370ea7a88e7623..1e33aeee51a9a4d728e4588929a0d66b9457a8bb 100644 --- a/tasks/agg-p01-n08-s05/instruction.md +++ b/tasks/agg-p01-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n08-s05/tests/test.sh b/tasks/agg-p01-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n08-s05/tests/test.sh +++ b/tasks/agg-p01-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n08-s06/instruction.md b/tasks/agg-p01-n08-s06/instruction.md index 2c724ce2f54c8829b6d803659e7e96973259720e..162682e2e51553326a61ee7f19eafb58e7dcde79 100644 --- a/tasks/agg-p01-n08-s06/instruction.md +++ b/tasks/agg-p01-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n08-s06/tests/test.sh b/tasks/agg-p01-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n08-s06/tests/test.sh +++ b/tasks/agg-p01-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n08-s07/instruction.md b/tasks/agg-p01-n08-s07/instruction.md index 7c109cd4ed8453a6b5a2f8e25324d7442a538dd5..63cb81cc7cd8df79b35989c57d33d53121b8e6da 100644 --- a/tasks/agg-p01-n08-s07/instruction.md +++ b/tasks/agg-p01-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n08-s07/tests/test.sh b/tasks/agg-p01-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n08-s07/tests/test.sh +++ b/tasks/agg-p01-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n08-s08/instruction.md b/tasks/agg-p01-n08-s08/instruction.md index b972a48112ea31bbb92b19d1817bc5119ac04601..f5506dd4b4102b3440ace8d4668dab6d0b4cb826 100644 --- a/tasks/agg-p01-n08-s08/instruction.md +++ b/tasks/agg-p01-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n08-s08/tests/test.sh b/tasks/agg-p01-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n08-s08/tests/test.sh +++ b/tasks/agg-p01-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n12-s01/instruction.md b/tasks/agg-p01-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f8a7f84dc10e74d2d1efa1c93d0465b237cf01e --- /dev/null +++ b/tasks/agg-p01-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n12-s01/solution/solve.sh b/tasks/agg-p01-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3336b677fce0b64ef24a88e562b020a6ec33a8f1 --- /dev/null +++ b/tasks/agg-p01-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97]' > "$answer" diff --git a/tasks/agg-p01-n12-s01/task.toml b/tasks/agg-p01-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b79b1f67c898c86e4557a20542c39babaae9be6d --- /dev/null +++ b/tasks/agg-p01-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n12-s01/tests/expected.json b/tasks/agg-p01-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..65c61192ec18a4ca70a5c75bdb65ed45c7349bf0 --- /dev/null +++ b/tasks/agg-p01-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97] diff --git a/tasks/agg-p01-n12-s01/tests/test.sh b/tasks/agg-p01-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n12-s02/instruction.md b/tasks/agg-p01-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4b6846cf5858ebd04826d2b7bdf1b417a38f4471 --- /dev/null +++ b/tasks/agg-p01-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n12-s02/solution/solve.sh b/tasks/agg-p01-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3336b677fce0b64ef24a88e562b020a6ec33a8f1 --- /dev/null +++ b/tasks/agg-p01-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97]' > "$answer" diff --git a/tasks/agg-p01-n12-s02/task.toml b/tasks/agg-p01-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cbcae99669a8aa57563231574ae497297955f129 --- /dev/null +++ b/tasks/agg-p01-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n12-s02/tests/expected.json b/tasks/agg-p01-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..65c61192ec18a4ca70a5c75bdb65ed45c7349bf0 --- /dev/null +++ b/tasks/agg-p01-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97] diff --git a/tasks/agg-p01-n12-s02/tests/test.sh b/tasks/agg-p01-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n12-s03/instruction.md b/tasks/agg-p01-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bcda533fb0b3407f78cfaf5c16a551ac6f72aead --- /dev/null +++ b/tasks/agg-p01-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n12-s03/solution/solve.sh b/tasks/agg-p01-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3336b677fce0b64ef24a88e562b020a6ec33a8f1 --- /dev/null +++ b/tasks/agg-p01-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97]' > "$answer" diff --git a/tasks/agg-p01-n12-s03/task.toml b/tasks/agg-p01-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e96404c1bd4e8b805b807755142a335caff5e918 --- /dev/null +++ b/tasks/agg-p01-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n12-s03/tests/expected.json b/tasks/agg-p01-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..65c61192ec18a4ca70a5c75bdb65ed45c7349bf0 --- /dev/null +++ b/tasks/agg-p01-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97] diff --git a/tasks/agg-p01-n12-s03/tests/test.sh b/tasks/agg-p01-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n12-s04/instruction.md b/tasks/agg-p01-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8be11b5883f82241c1bfcc5354eaf615e8c586fb --- /dev/null +++ b/tasks/agg-p01-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n12-s04/solution/solve.sh b/tasks/agg-p01-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3336b677fce0b64ef24a88e562b020a6ec33a8f1 --- /dev/null +++ b/tasks/agg-p01-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97]' > "$answer" diff --git a/tasks/agg-p01-n12-s04/task.toml b/tasks/agg-p01-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9cb3324db88443a307b78a501561a544928047eb --- /dev/null +++ b/tasks/agg-p01-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n12-s04/tests/expected.json b/tasks/agg-p01-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..65c61192ec18a4ca70a5c75bdb65ed45c7349bf0 --- /dev/null +++ b/tasks/agg-p01-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97] diff --git a/tasks/agg-p01-n12-s04/tests/test.sh b/tasks/agg-p01-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n12-s05/instruction.md b/tasks/agg-p01-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bcda533fb0b3407f78cfaf5c16a551ac6f72aead --- /dev/null +++ b/tasks/agg-p01-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n12-s05/solution/solve.sh b/tasks/agg-p01-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3336b677fce0b64ef24a88e562b020a6ec33a8f1 --- /dev/null +++ b/tasks/agg-p01-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97]' > "$answer" diff --git a/tasks/agg-p01-n12-s05/task.toml b/tasks/agg-p01-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c79bc2239a08b668f5cfb84ded606930b7909cb4 --- /dev/null +++ b/tasks/agg-p01-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n12-s05/tests/expected.json b/tasks/agg-p01-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..65c61192ec18a4ca70a5c75bdb65ed45c7349bf0 --- /dev/null +++ b/tasks/agg-p01-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97] diff --git a/tasks/agg-p01-n12-s05/tests/test.sh b/tasks/agg-p01-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n12-s06/instruction.md b/tasks/agg-p01-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..894c08d452dd150a471307a3b982c78b62f7152f --- /dev/null +++ b/tasks/agg-p01-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n12-s06/solution/solve.sh b/tasks/agg-p01-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3336b677fce0b64ef24a88e562b020a6ec33a8f1 --- /dev/null +++ b/tasks/agg-p01-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97]' > "$answer" diff --git a/tasks/agg-p01-n12-s06/task.toml b/tasks/agg-p01-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..67ef38de33874b9d885736856ee8f37aea14e8f9 --- /dev/null +++ b/tasks/agg-p01-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n12-s06/tests/expected.json b/tasks/agg-p01-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..65c61192ec18a4ca70a5c75bdb65ed45c7349bf0 --- /dev/null +++ b/tasks/agg-p01-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97] diff --git a/tasks/agg-p01-n12-s06/tests/test.sh b/tasks/agg-p01-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n12-s07/instruction.md b/tasks/agg-p01-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..02901bb1828d807a2d28e8fb148344dbe048c353 --- /dev/null +++ b/tasks/agg-p01-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n12-s07/solution/solve.sh b/tasks/agg-p01-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3336b677fce0b64ef24a88e562b020a6ec33a8f1 --- /dev/null +++ b/tasks/agg-p01-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97]' > "$answer" diff --git a/tasks/agg-p01-n12-s07/task.toml b/tasks/agg-p01-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8dc0034cd497ee66b1dbce213570b4328e491bd2 --- /dev/null +++ b/tasks/agg-p01-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n12-s07/tests/expected.json b/tasks/agg-p01-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..65c61192ec18a4ca70a5c75bdb65ed45c7349bf0 --- /dev/null +++ b/tasks/agg-p01-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97] diff --git a/tasks/agg-p01-n12-s07/tests/test.sh b/tasks/agg-p01-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n12-s08/instruction.md b/tasks/agg-p01-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6f3f8fe41060e201182cc94c7cf026320c69b36b --- /dev/null +++ b/tasks/agg-p01-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n12-s08/solution/solve.sh b/tasks/agg-p01-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3336b677fce0b64ef24a88e562b020a6ec33a8f1 --- /dev/null +++ b/tasks/agg-p01-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97]' > "$answer" diff --git a/tasks/agg-p01-n12-s08/task.toml b/tasks/agg-p01-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b7f1f230966f0a4249c8831e85dfe779bb9504a0 --- /dev/null +++ b/tasks/agg-p01-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n12-s08/tests/expected.json b/tasks/agg-p01-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..65c61192ec18a4ca70a5c75bdb65ed45c7349bf0 --- /dev/null +++ b/tasks/agg-p01-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97] diff --git a/tasks/agg-p01-n12-s08/tests/test.sh b/tasks/agg-p01-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n12-s09/instruction.md b/tasks/agg-p01-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bb40c13254db093b772375b0bb70c64bc0b6f8b8 --- /dev/null +++ b/tasks/agg-p01-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n12-s09/solution/solve.sh b/tasks/agg-p01-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3336b677fce0b64ef24a88e562b020a6ec33a8f1 --- /dev/null +++ b/tasks/agg-p01-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97]' > "$answer" diff --git a/tasks/agg-p01-n12-s09/task.toml b/tasks/agg-p01-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..340c7a8ac1ac034eb0becaf4ca51fdd7e16f0a06 --- /dev/null +++ b/tasks/agg-p01-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n12-s09/tests/expected.json b/tasks/agg-p01-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..65c61192ec18a4ca70a5c75bdb65ed45c7349bf0 --- /dev/null +++ b/tasks/agg-p01-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97] diff --git a/tasks/agg-p01-n12-s09/tests/test.sh b/tasks/agg-p01-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n12-s10/instruction.md b/tasks/agg-p01-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..031c703efd3d4ee9d7e52a3211272bdd8fdb3bc4 --- /dev/null +++ b/tasks/agg-p01-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n12-s10/solution/solve.sh b/tasks/agg-p01-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3336b677fce0b64ef24a88e562b020a6ec33a8f1 --- /dev/null +++ b/tasks/agg-p01-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97]' > "$answer" diff --git a/tasks/agg-p01-n12-s10/task.toml b/tasks/agg-p01-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d249420a75127f7d0179a2f3fdefef9801149ea0 --- /dev/null +++ b/tasks/agg-p01-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n12-s10/tests/expected.json b/tasks/agg-p01-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..65c61192ec18a4ca70a5c75bdb65ed45c7349bf0 --- /dev/null +++ b/tasks/agg-p01-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97] diff --git a/tasks/agg-p01-n12-s10/tests/test.sh b/tasks/agg-p01-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n12-s11/instruction.md b/tasks/agg-p01-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cf78bc234ac7165a12e4210d637bece975cb648e --- /dev/null +++ b/tasks/agg-p01-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n12-s11/solution/solve.sh b/tasks/agg-p01-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3336b677fce0b64ef24a88e562b020a6ec33a8f1 --- /dev/null +++ b/tasks/agg-p01-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97]' > "$answer" diff --git a/tasks/agg-p01-n12-s11/task.toml b/tasks/agg-p01-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9d0b8ff49c25e960acf45584483d5e9c72b5f124 --- /dev/null +++ b/tasks/agg-p01-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n12-s11/tests/expected.json b/tasks/agg-p01-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..65c61192ec18a4ca70a5c75bdb65ed45c7349bf0 --- /dev/null +++ b/tasks/agg-p01-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97] diff --git a/tasks/agg-p01-n12-s11/tests/test.sh b/tasks/agg-p01-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n12-s12/instruction.md b/tasks/agg-p01-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f8a7f84dc10e74d2d1efa1c93d0465b237cf01e --- /dev/null +++ b/tasks/agg-p01-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n12-s12/solution/solve.sh b/tasks/agg-p01-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..3336b677fce0b64ef24a88e562b020a6ec33a8f1 --- /dev/null +++ b/tasks/agg-p01-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97]' > "$answer" diff --git a/tasks/agg-p01-n12-s12/task.toml b/tasks/agg-p01-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5751911671260a4f2f63c97ccd621a039a87e8db --- /dev/null +++ b/tasks/agg-p01-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p01-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 1 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p01-n12-s12/tests/expected.json b/tasks/agg-p01-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..65c61192ec18a4ca70a5c75bdb65ed45c7349bf0 --- /dev/null +++ b/tasks/agg-p01-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[15, 15, 26, 37, 37, 38, 43, 69, 71, 82, 87, 97] diff --git a/tasks/agg-p01-n12-s12/tests/test.sh b/tasks/agg-p01-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p01-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p01-n16-s01/instruction.md b/tasks/agg-p01-n16-s01/instruction.md index 10bcc3d169e35738b1fb80abb7316f9cd7c1b230..254a759d5a0113deb55448c366676577f275a1f1 100644 --- a/tasks/agg-p01-n16-s01/instruction.md +++ b/tasks/agg-p01-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s01/tests/test.sh b/tasks/agg-p01-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s01/tests/test.sh +++ b/tasks/agg-p01-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s02/instruction.md b/tasks/agg-p01-n16-s02/instruction.md index 25a3352a6fb27d091e48ef26af1f89bbaefa3612..51708efc2e71807a279f9af965f1a691bfad9276 100644 --- a/tasks/agg-p01-n16-s02/instruction.md +++ b/tasks/agg-p01-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s02/tests/test.sh b/tasks/agg-p01-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s02/tests/test.sh +++ b/tasks/agg-p01-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s03/instruction.md b/tasks/agg-p01-n16-s03/instruction.md index 7cf63660731cfb255f4030930d1fa31a717d902f..6dab277b2fabfee8f34045a8f6fb47ac3384734d 100644 --- a/tasks/agg-p01-n16-s03/instruction.md +++ b/tasks/agg-p01-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s03/tests/test.sh b/tasks/agg-p01-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s03/tests/test.sh +++ b/tasks/agg-p01-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s04/instruction.md b/tasks/agg-p01-n16-s04/instruction.md index 7db3d283effcee2e29406da16a63a785bcffa3f6..bd72b4cb3ef80fa76d635dbc7ca834354ab9abf2 100644 --- a/tasks/agg-p01-n16-s04/instruction.md +++ b/tasks/agg-p01-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s04/tests/test.sh b/tasks/agg-p01-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s04/tests/test.sh +++ b/tasks/agg-p01-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s05/instruction.md b/tasks/agg-p01-n16-s05/instruction.md index 7cf63660731cfb255f4030930d1fa31a717d902f..6dab277b2fabfee8f34045a8f6fb47ac3384734d 100644 --- a/tasks/agg-p01-n16-s05/instruction.md +++ b/tasks/agg-p01-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s05/tests/test.sh b/tasks/agg-p01-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s05/tests/test.sh +++ b/tasks/agg-p01-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s06/instruction.md b/tasks/agg-p01-n16-s06/instruction.md index c0f9d178a1c3057c8c4b57e9c5eca4e4c625b138..efa987bc861271d3fcd4cc6f1530e4d2ecbb6990 100644 --- a/tasks/agg-p01-n16-s06/instruction.md +++ b/tasks/agg-p01-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s06/tests/test.sh b/tasks/agg-p01-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s06/tests/test.sh +++ b/tasks/agg-p01-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s07/instruction.md b/tasks/agg-p01-n16-s07/instruction.md index 2b88f98c808d50d8812e112db76251266368fe80..3162a9d23282256e321282ae9170e9de281da28f 100644 --- a/tasks/agg-p01-n16-s07/instruction.md +++ b/tasks/agg-p01-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s07/tests/test.sh b/tasks/agg-p01-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s07/tests/test.sh +++ b/tasks/agg-p01-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s08/instruction.md b/tasks/agg-p01-n16-s08/instruction.md index 722dd06eb5b0a1781e34a4a84c87448b77da2a59..5e39eb31f3bfe02211382c86f30186b5bbd8d4ba 100644 --- a/tasks/agg-p01-n16-s08/instruction.md +++ b/tasks/agg-p01-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s08/tests/test.sh b/tasks/agg-p01-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s08/tests/test.sh +++ b/tasks/agg-p01-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s09/instruction.md b/tasks/agg-p01-n16-s09/instruction.md index d398ea97722601a49a457530f502678c0a1433cf..e1c1f7d3b01724d8dea774465c5f5d8397b1d161 100644 --- a/tasks/agg-p01-n16-s09/instruction.md +++ b/tasks/agg-p01-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s09/tests/test.sh b/tasks/agg-p01-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s09/tests/test.sh +++ b/tasks/agg-p01-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s10/instruction.md b/tasks/agg-p01-n16-s10/instruction.md index 3c1a8c1b0c33b8354227b277a5b1885c3067b4d2..6a9948c4088c17e7b78a078e0010c060500c2e8e 100644 --- a/tasks/agg-p01-n16-s10/instruction.md +++ b/tasks/agg-p01-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s10/tests/test.sh b/tasks/agg-p01-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s10/tests/test.sh +++ b/tasks/agg-p01-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s11/instruction.md b/tasks/agg-p01-n16-s11/instruction.md index 8719f945164b6c7adba0eec9b9728be32d6bfe5e..10a630b21435ec8e620ae5e83c5dc41b678c1031 100644 --- a/tasks/agg-p01-n16-s11/instruction.md +++ b/tasks/agg-p01-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s11/tests/test.sh b/tasks/agg-p01-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s11/tests/test.sh +++ b/tasks/agg-p01-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s12/instruction.md b/tasks/agg-p01-n16-s12/instruction.md index 10bcc3d169e35738b1fb80abb7316f9cd7c1b230..254a759d5a0113deb55448c366676577f275a1f1 100644 --- a/tasks/agg-p01-n16-s12/instruction.md +++ b/tasks/agg-p01-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s12/tests/test.sh b/tasks/agg-p01-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s12/tests/test.sh +++ b/tasks/agg-p01-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s13/instruction.md b/tasks/agg-p01-n16-s13/instruction.md index f197f79da6e4638891b46f2053909c167ec13c32..856f7627093ea9ba708f7c4461f757925253fef9 100644 --- a/tasks/agg-p01-n16-s13/instruction.md +++ b/tasks/agg-p01-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s13/tests/test.sh b/tasks/agg-p01-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s13/tests/test.sh +++ b/tasks/agg-p01-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s14/instruction.md b/tasks/agg-p01-n16-s14/instruction.md index a31300409e75190524f2a237c2d0d6348715dc53..106160b98d71014a9eaa408fdaab716f872544a2 100644 --- a/tasks/agg-p01-n16-s14/instruction.md +++ b/tasks/agg-p01-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s14/tests/test.sh b/tasks/agg-p01-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s14/tests/test.sh +++ b/tasks/agg-p01-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s15/instruction.md b/tasks/agg-p01-n16-s15/instruction.md index 81fbf2c2720ed316086419e84cc080153e8dc4cd..2c7e0125bf7b6189a66b80f4f9f491784a6708e4 100644 --- a/tasks/agg-p01-n16-s15/instruction.md +++ b/tasks/agg-p01-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s15/tests/test.sh b/tasks/agg-p01-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s15/tests/test.sh +++ b/tasks/agg-p01-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p01-n16-s16/instruction.md b/tasks/agg-p01-n16-s16/instruction.md index 99a7f97eb2774bf91fcf02fc9e18c71f2c746d9d..b0c86232070beace6f6b66df51114731c8869870 100644 --- a/tasks/agg-p01-n16-s16/instruction.md +++ b/tasks/agg-p01-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p01-n16-s16/tests/test.sh b/tasks/agg-p01-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p01-n16-s16/tests/test.sh +++ b/tasks/agg-p01-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n01-s01/instruction.md b/tasks/agg-p02-n01-s01/instruction.md index cbfa858dcbcede358d8c2f479cb9104f5c79da1b..f407e507b1c3caf6906d2bb5860c827a99a085fa 100644 --- a/tasks/agg-p02-n01-s01/instruction.md +++ b/tasks/agg-p02-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is seventy-one. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p02-n01-s01/tests/test.sh b/tasks/agg-p02-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n01-s01/tests/test.sh +++ b/tasks/agg-p02-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n02-s01/instruction.md b/tasks/agg-p02-n02-s01/instruction.md index f7d66ca758c425370551bcb6e22062cbefbd9f97..64ec0a909104efc7c7b0bbd273ba187f2b7e492a 100644 --- a/tasks/agg-p02-n02-s01/instruction.md +++ b/tasks/agg-p02-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n02-s01/tests/test.sh b/tasks/agg-p02-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n02-s01/tests/test.sh +++ b/tasks/agg-p02-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n02-s02/instruction.md b/tasks/agg-p02-n02-s02/instruction.md index f7d66ca758c425370551bcb6e22062cbefbd9f97..64ec0a909104efc7c7b0bbd273ba187f2b7e492a 100644 --- a/tasks/agg-p02-n02-s02/instruction.md +++ b/tasks/agg-p02-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n02-s02/tests/test.sh b/tasks/agg-p02-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n02-s02/tests/test.sh +++ b/tasks/agg-p02-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n04-s01/instruction.md b/tasks/agg-p02-n04-s01/instruction.md index 430467a8c33661604553077a8a27e968376d25e5..080d5e6688850a817b1442e6f0fdcbe6a87cf876 100644 --- a/tasks/agg-p02-n04-s01/instruction.md +++ b/tasks/agg-p02-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n04-s01/tests/test.sh b/tasks/agg-p02-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n04-s01/tests/test.sh +++ b/tasks/agg-p02-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n04-s02/instruction.md b/tasks/agg-p02-n04-s02/instruction.md index 430467a8c33661604553077a8a27e968376d25e5..080d5e6688850a817b1442e6f0fdcbe6a87cf876 100644 --- a/tasks/agg-p02-n04-s02/instruction.md +++ b/tasks/agg-p02-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n04-s02/tests/test.sh b/tasks/agg-p02-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n04-s02/tests/test.sh +++ b/tasks/agg-p02-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n04-s03/instruction.md b/tasks/agg-p02-n04-s03/instruction.md index 8229ec32a8706beb71697adddf42a1fc48ee812a..0cce0cc72b847f422e9282a2d3dd61a1916d9953 100644 --- a/tasks/agg-p02-n04-s03/instruction.md +++ b/tasks/agg-p02-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n04-s03/tests/test.sh b/tasks/agg-p02-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n04-s03/tests/test.sh +++ b/tasks/agg-p02-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n04-s04/instruction.md b/tasks/agg-p02-n04-s04/instruction.md index 862177065dd1207d2cfdca97cd16d4c00c321796..e2872ca13a9bdaac009d4ea9f256c26db9299563 100644 --- a/tasks/agg-p02-n04-s04/instruction.md +++ b/tasks/agg-p02-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n04-s04/tests/test.sh b/tasks/agg-p02-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n04-s04/tests/test.sh +++ b/tasks/agg-p02-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n06-s01/instruction.md b/tasks/agg-p02-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c10b04dc835d0dca589f77fcc2261a294978adf2 --- /dev/null +++ b/tasks/agg-p02-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n06-s01/solution/solve.sh b/tasks/agg-p02-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ac28849b6d0cd19f363f5c3d7c2ad043ede02879 --- /dev/null +++ b/tasks/agg-p02-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 37, 71, 71]' > "$answer" diff --git a/tasks/agg-p02-n06-s01/task.toml b/tasks/agg-p02-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..38235c045c82bce225cd1e67dd408a09a904c2a1 --- /dev/null +++ b/tasks/agg-p02-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n06-s01/tests/expected.json b/tasks/agg-p02-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7d541cebd309cea6976e03edd77b02c0dc4c3e5c --- /dev/null +++ b/tasks/agg-p02-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 37, 71, 71] diff --git a/tasks/agg-p02-n06-s01/tests/test.sh b/tasks/agg-p02-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n06-s02/instruction.md b/tasks/agg-p02-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c10b04dc835d0dca589f77fcc2261a294978adf2 --- /dev/null +++ b/tasks/agg-p02-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n06-s02/solution/solve.sh b/tasks/agg-p02-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ac28849b6d0cd19f363f5c3d7c2ad043ede02879 --- /dev/null +++ b/tasks/agg-p02-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 37, 71, 71]' > "$answer" diff --git a/tasks/agg-p02-n06-s02/task.toml b/tasks/agg-p02-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3755b7f1d60395f0b64460757c9617338ef64aec --- /dev/null +++ b/tasks/agg-p02-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n06-s02/tests/expected.json b/tasks/agg-p02-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7d541cebd309cea6976e03edd77b02c0dc4c3e5c --- /dev/null +++ b/tasks/agg-p02-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 37, 71, 71] diff --git a/tasks/agg-p02-n06-s02/tests/test.sh b/tasks/agg-p02-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n06-s03/instruction.md b/tasks/agg-p02-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a3162e0c3af58aba4c255d22f35fe5415203df89 --- /dev/null +++ b/tasks/agg-p02-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is nineteen. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n06-s03/solution/solve.sh b/tasks/agg-p02-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ac28849b6d0cd19f363f5c3d7c2ad043ede02879 --- /dev/null +++ b/tasks/agg-p02-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 37, 71, 71]' > "$answer" diff --git a/tasks/agg-p02-n06-s03/task.toml b/tasks/agg-p02-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7d291d96997dd19fd1b45e0063c9a4b5a3d64d11 --- /dev/null +++ b/tasks/agg-p02-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n06-s03/tests/expected.json b/tasks/agg-p02-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7d541cebd309cea6976e03edd77b02c0dc4c3e5c --- /dev/null +++ b/tasks/agg-p02-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 37, 71, 71] diff --git a/tasks/agg-p02-n06-s03/tests/test.sh b/tasks/agg-p02-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n06-s04/instruction.md b/tasks/agg-p02-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ca32ee2be3fc2697faddd2a4c3d7eb5a3243d9ec --- /dev/null +++ b/tasks/agg-p02-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n06-s04/solution/solve.sh b/tasks/agg-p02-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ac28849b6d0cd19f363f5c3d7c2ad043ede02879 --- /dev/null +++ b/tasks/agg-p02-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 37, 71, 71]' > "$answer" diff --git a/tasks/agg-p02-n06-s04/task.toml b/tasks/agg-p02-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3f6fa0b728f9f49a4bef50064fe3ab0e623ecb4f --- /dev/null +++ b/tasks/agg-p02-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n06-s04/tests/expected.json b/tasks/agg-p02-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7d541cebd309cea6976e03edd77b02c0dc4c3e5c --- /dev/null +++ b/tasks/agg-p02-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 37, 71, 71] diff --git a/tasks/agg-p02-n06-s04/tests/test.sh b/tasks/agg-p02-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n06-s05/instruction.md b/tasks/agg-p02-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e3b9ca081f34f486ae59990745cd2c0235f9d01c --- /dev/null +++ b/tasks/agg-p02-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n06-s05/solution/solve.sh b/tasks/agg-p02-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ac28849b6d0cd19f363f5c3d7c2ad043ede02879 --- /dev/null +++ b/tasks/agg-p02-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 37, 71, 71]' > "$answer" diff --git a/tasks/agg-p02-n06-s05/task.toml b/tasks/agg-p02-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2fffd92d5a8107482340b136c74ceceaf3940730 --- /dev/null +++ b/tasks/agg-p02-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n06-s05/tests/expected.json b/tasks/agg-p02-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7d541cebd309cea6976e03edd77b02c0dc4c3e5c --- /dev/null +++ b/tasks/agg-p02-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 37, 71, 71] diff --git a/tasks/agg-p02-n06-s05/tests/test.sh b/tasks/agg-p02-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n06-s06/instruction.md b/tasks/agg-p02-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b24b39ec78a0cf7e450c5ad8eba4aa7d5a4a5b36 --- /dev/null +++ b/tasks/agg-p02-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n06-s06/solution/solve.sh b/tasks/agg-p02-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..ac28849b6d0cd19f363f5c3d7c2ad043ede02879 --- /dev/null +++ b/tasks/agg-p02-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 37, 71, 71]' > "$answer" diff --git a/tasks/agg-p02-n06-s06/task.toml b/tasks/agg-p02-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7fbbc46a004c3ba9cce016f3985c2b3c7f053124 --- /dev/null +++ b/tasks/agg-p02-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n06-s06/tests/expected.json b/tasks/agg-p02-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7d541cebd309cea6976e03edd77b02c0dc4c3e5c --- /dev/null +++ b/tasks/agg-p02-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 37, 71, 71] diff --git a/tasks/agg-p02-n06-s06/tests/test.sh b/tasks/agg-p02-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n08-s01/instruction.md b/tasks/agg-p02-n08-s01/instruction.md index b972a48112ea31bbb92b19d1817bc5119ac04601..f5506dd4b4102b3440ace8d4668dab6d0b4cb826 100644 --- a/tasks/agg-p02-n08-s01/instruction.md +++ b/tasks/agg-p02-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n08-s01/tests/test.sh b/tasks/agg-p02-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n08-s01/tests/test.sh +++ b/tasks/agg-p02-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n08-s02/instruction.md b/tasks/agg-p02-n08-s02/instruction.md index b972a48112ea31bbb92b19d1817bc5119ac04601..f5506dd4b4102b3440ace8d4668dab6d0b4cb826 100644 --- a/tasks/agg-p02-n08-s02/instruction.md +++ b/tasks/agg-p02-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n08-s02/tests/test.sh b/tasks/agg-p02-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n08-s02/tests/test.sh +++ b/tasks/agg-p02-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n08-s03/instruction.md b/tasks/agg-p02-n08-s03/instruction.md index e9260e41c83d52ff81d0cd24ab3bbcb722f43da1..002ff3f87af341baf7f43668a34cdab1fe436a4d 100644 --- a/tasks/agg-p02-n08-s03/instruction.md +++ b/tasks/agg-p02-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n08-s03/tests/test.sh b/tasks/agg-p02-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n08-s03/tests/test.sh +++ b/tasks/agg-p02-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n08-s04/instruction.md b/tasks/agg-p02-n08-s04/instruction.md index 45eef35ac00156eccf1849f3e7ce1978b9164536..e36fc7742cbb8f0fb0f25695cdfaa81e0348306d 100644 --- a/tasks/agg-p02-n08-s04/instruction.md +++ b/tasks/agg-p02-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n08-s04/tests/test.sh b/tasks/agg-p02-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n08-s04/tests/test.sh +++ b/tasks/agg-p02-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n08-s05/instruction.md b/tasks/agg-p02-n08-s05/instruction.md index cf3f948e811657d947ed622b357f1d1ea8535635..11b308d9edcb7cc85390662efc67a129d6c33242 100644 --- a/tasks/agg-p02-n08-s05/instruction.md +++ b/tasks/agg-p02-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n08-s05/tests/test.sh b/tasks/agg-p02-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n08-s05/tests/test.sh +++ b/tasks/agg-p02-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n08-s06/instruction.md b/tasks/agg-p02-n08-s06/instruction.md index d28771240990d9554944b9ef68d9203e0acd7f13..99290acfb8baa2927750e2841040ecf9ddb5f1fa 100644 --- a/tasks/agg-p02-n08-s06/instruction.md +++ b/tasks/agg-p02-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n08-s06/tests/test.sh b/tasks/agg-p02-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n08-s06/tests/test.sh +++ b/tasks/agg-p02-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n08-s07/instruction.md b/tasks/agg-p02-n08-s07/instruction.md index 5b14deaa7622dc83330db4194d812edbd5c8daec..93afa9364b0adb56c55e6be58f7c5120524812fd 100644 --- a/tasks/agg-p02-n08-s07/instruction.md +++ b/tasks/agg-p02-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n08-s07/tests/test.sh b/tasks/agg-p02-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n08-s07/tests/test.sh +++ b/tasks/agg-p02-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n08-s08/instruction.md b/tasks/agg-p02-n08-s08/instruction.md index 6770f155a73f8160420b131a19f4e1c1ecc0b159..a807811225f95af60844b17548c90165594e5e78 100644 --- a/tasks/agg-p02-n08-s08/instruction.md +++ b/tasks/agg-p02-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n08-s08/tests/test.sh b/tasks/agg-p02-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n08-s08/tests/test.sh +++ b/tasks/agg-p02-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n12-s01/instruction.md b/tasks/agg-p02-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6f3f8fe41060e201182cc94c7cf026320c69b36b --- /dev/null +++ b/tasks/agg-p02-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n12-s01/solution/solve.sh b/tasks/agg-p02-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..37904c3628e3fdfba6fc82985e973276325ec2bb --- /dev/null +++ b/tasks/agg-p02-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95]' > "$answer" diff --git a/tasks/agg-p02-n12-s01/task.toml b/tasks/agg-p02-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..20b76991e7b03fdd9d9a620f88a369e9e8f031e7 --- /dev/null +++ b/tasks/agg-p02-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n12-s01/tests/expected.json b/tasks/agg-p02-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3d5f4b785d6e677f18655019aa0dbea1b63278b0 --- /dev/null +++ b/tasks/agg-p02-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95] diff --git a/tasks/agg-p02-n12-s01/tests/test.sh b/tasks/agg-p02-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n12-s02/instruction.md b/tasks/agg-p02-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6f3f8fe41060e201182cc94c7cf026320c69b36b --- /dev/null +++ b/tasks/agg-p02-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n12-s02/solution/solve.sh b/tasks/agg-p02-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..37904c3628e3fdfba6fc82985e973276325ec2bb --- /dev/null +++ b/tasks/agg-p02-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95]' > "$answer" diff --git a/tasks/agg-p02-n12-s02/task.toml b/tasks/agg-p02-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2779eef23b64059508a301645f407e3ce5274b7f --- /dev/null +++ b/tasks/agg-p02-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n12-s02/tests/expected.json b/tasks/agg-p02-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3d5f4b785d6e677f18655019aa0dbea1b63278b0 --- /dev/null +++ b/tasks/agg-p02-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95] diff --git a/tasks/agg-p02-n12-s02/tests/test.sh b/tasks/agg-p02-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n12-s03/instruction.md b/tasks/agg-p02-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d20cc8cc1f1c9617a83e07868fc43399bd7b4a36 --- /dev/null +++ b/tasks/agg-p02-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is nineteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n12-s03/solution/solve.sh b/tasks/agg-p02-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..37904c3628e3fdfba6fc82985e973276325ec2bb --- /dev/null +++ b/tasks/agg-p02-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95]' > "$answer" diff --git a/tasks/agg-p02-n12-s03/task.toml b/tasks/agg-p02-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f15a5ac18a88facd7390d37d9837e4dea620ee23 --- /dev/null +++ b/tasks/agg-p02-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n12-s03/tests/expected.json b/tasks/agg-p02-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3d5f4b785d6e677f18655019aa0dbea1b63278b0 --- /dev/null +++ b/tasks/agg-p02-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95] diff --git a/tasks/agg-p02-n12-s03/tests/test.sh b/tasks/agg-p02-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n12-s04/instruction.md b/tasks/agg-p02-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cceebebec44b442f3530d40bdabf89079a1da1a4 --- /dev/null +++ b/tasks/agg-p02-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n12-s04/solution/solve.sh b/tasks/agg-p02-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..37904c3628e3fdfba6fc82985e973276325ec2bb --- /dev/null +++ b/tasks/agg-p02-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95]' > "$answer" diff --git a/tasks/agg-p02-n12-s04/task.toml b/tasks/agg-p02-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4071e4e2e19ce6bb73baaec3f279cce22db83bd9 --- /dev/null +++ b/tasks/agg-p02-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n12-s04/tests/expected.json b/tasks/agg-p02-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3d5f4b785d6e677f18655019aa0dbea1b63278b0 --- /dev/null +++ b/tasks/agg-p02-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95] diff --git a/tasks/agg-p02-n12-s04/tests/test.sh b/tasks/agg-p02-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n12-s05/instruction.md b/tasks/agg-p02-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e9a64c0f27aa67e1cac11aadbbf81280d4edf727 --- /dev/null +++ b/tasks/agg-p02-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n12-s05/solution/solve.sh b/tasks/agg-p02-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..37904c3628e3fdfba6fc82985e973276325ec2bb --- /dev/null +++ b/tasks/agg-p02-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95]' > "$answer" diff --git a/tasks/agg-p02-n12-s05/task.toml b/tasks/agg-p02-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..98c1942e19c1f0e7f00e61c03af963430bfcf108 --- /dev/null +++ b/tasks/agg-p02-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n12-s05/tests/expected.json b/tasks/agg-p02-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3d5f4b785d6e677f18655019aa0dbea1b63278b0 --- /dev/null +++ b/tasks/agg-p02-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95] diff --git a/tasks/agg-p02-n12-s05/tests/test.sh b/tasks/agg-p02-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n12-s06/instruction.md b/tasks/agg-p02-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f8a7f84dc10e74d2d1efa1c93d0465b237cf01e --- /dev/null +++ b/tasks/agg-p02-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n12-s06/solution/solve.sh b/tasks/agg-p02-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..37904c3628e3fdfba6fc82985e973276325ec2bb --- /dev/null +++ b/tasks/agg-p02-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95]' > "$answer" diff --git a/tasks/agg-p02-n12-s06/task.toml b/tasks/agg-p02-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7df839c56b5fc58a177f294c4c704449f8b55345 --- /dev/null +++ b/tasks/agg-p02-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n12-s06/tests/expected.json b/tasks/agg-p02-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3d5f4b785d6e677f18655019aa0dbea1b63278b0 --- /dev/null +++ b/tasks/agg-p02-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95] diff --git a/tasks/agg-p02-n12-s06/tests/test.sh b/tasks/agg-p02-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n12-s07/instruction.md b/tasks/agg-p02-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1ec3d2a16079c4d9737f2784ae217eea77d88533 --- /dev/null +++ b/tasks/agg-p02-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n12-s07/solution/solve.sh b/tasks/agg-p02-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..37904c3628e3fdfba6fc82985e973276325ec2bb --- /dev/null +++ b/tasks/agg-p02-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95]' > "$answer" diff --git a/tasks/agg-p02-n12-s07/task.toml b/tasks/agg-p02-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..69da4734025588bbdb6574f2764ecf1b162107e1 --- /dev/null +++ b/tasks/agg-p02-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n12-s07/tests/expected.json b/tasks/agg-p02-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3d5f4b785d6e677f18655019aa0dbea1b63278b0 --- /dev/null +++ b/tasks/agg-p02-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95] diff --git a/tasks/agg-p02-n12-s07/tests/test.sh b/tasks/agg-p02-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n12-s08/instruction.md b/tasks/agg-p02-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7c90856f9c373634a273d06e4b993632457cf3cf --- /dev/null +++ b/tasks/agg-p02-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n12-s08/solution/solve.sh b/tasks/agg-p02-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..37904c3628e3fdfba6fc82985e973276325ec2bb --- /dev/null +++ b/tasks/agg-p02-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95]' > "$answer" diff --git a/tasks/agg-p02-n12-s08/task.toml b/tasks/agg-p02-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c4e1130e84055a36ccbe1a6b7d7ae1498748b433 --- /dev/null +++ b/tasks/agg-p02-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n12-s08/tests/expected.json b/tasks/agg-p02-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3d5f4b785d6e677f18655019aa0dbea1b63278b0 --- /dev/null +++ b/tasks/agg-p02-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95] diff --git a/tasks/agg-p02-n12-s08/tests/test.sh b/tasks/agg-p02-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n12-s09/instruction.md b/tasks/agg-p02-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f5aa8b70f2f447fb84dd6b26d80c8d7537bebefb --- /dev/null +++ b/tasks/agg-p02-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n12-s09/solution/solve.sh b/tasks/agg-p02-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..37904c3628e3fdfba6fc82985e973276325ec2bb --- /dev/null +++ b/tasks/agg-p02-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95]' > "$answer" diff --git a/tasks/agg-p02-n12-s09/task.toml b/tasks/agg-p02-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8ef938251b22ee6427f562c5a67d8909c156fb8a --- /dev/null +++ b/tasks/agg-p02-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n12-s09/tests/expected.json b/tasks/agg-p02-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3d5f4b785d6e677f18655019aa0dbea1b63278b0 --- /dev/null +++ b/tasks/agg-p02-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95] diff --git a/tasks/agg-p02-n12-s09/tests/test.sh b/tasks/agg-p02-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n12-s10/instruction.md b/tasks/agg-p02-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..55211891d2eae86ad815f2101b3fba33c6a19886 --- /dev/null +++ b/tasks/agg-p02-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n12-s10/solution/solve.sh b/tasks/agg-p02-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..37904c3628e3fdfba6fc82985e973276325ec2bb --- /dev/null +++ b/tasks/agg-p02-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95]' > "$answer" diff --git a/tasks/agg-p02-n12-s10/task.toml b/tasks/agg-p02-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..02cf86515a99c76df8c51429077edbd5d25a3b21 --- /dev/null +++ b/tasks/agg-p02-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n12-s10/tests/expected.json b/tasks/agg-p02-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3d5f4b785d6e677f18655019aa0dbea1b63278b0 --- /dev/null +++ b/tasks/agg-p02-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95] diff --git a/tasks/agg-p02-n12-s10/tests/test.sh b/tasks/agg-p02-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n12-s11/instruction.md b/tasks/agg-p02-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f2c76bb45009aa4b02f25d7f7c4771d329f4cb89 --- /dev/null +++ b/tasks/agg-p02-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n12-s11/solution/solve.sh b/tasks/agg-p02-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..37904c3628e3fdfba6fc82985e973276325ec2bb --- /dev/null +++ b/tasks/agg-p02-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95]' > "$answer" diff --git a/tasks/agg-p02-n12-s11/task.toml b/tasks/agg-p02-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b64aaa9c11719624ba8e8b2403bf4f25c603b40d --- /dev/null +++ b/tasks/agg-p02-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n12-s11/tests/expected.json b/tasks/agg-p02-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3d5f4b785d6e677f18655019aa0dbea1b63278b0 --- /dev/null +++ b/tasks/agg-p02-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95] diff --git a/tasks/agg-p02-n12-s11/tests/test.sh b/tasks/agg-p02-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n12-s12/instruction.md b/tasks/agg-p02-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b53986e9d0f1dda9020e6d798d3ea3ceceb7b772 --- /dev/null +++ b/tasks/agg-p02-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n12-s12/solution/solve.sh b/tasks/agg-p02-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..37904c3628e3fdfba6fc82985e973276325ec2bb --- /dev/null +++ b/tasks/agg-p02-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95]' > "$answer" diff --git a/tasks/agg-p02-n12-s12/task.toml b/tasks/agg-p02-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1ce2a4479d29c1d50955b76c8a59ec555c21d9c0 --- /dev/null +++ b/tasks/agg-p02-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p02-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 2 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p02-n12-s12/tests/expected.json b/tasks/agg-p02-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3d5f4b785d6e677f18655019aa0dbea1b63278b0 --- /dev/null +++ b/tasks/agg-p02-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[6, 19, 20, 22, 23, 32, 37, 63, 71, 71, 76, 95] diff --git a/tasks/agg-p02-n12-s12/tests/test.sh b/tasks/agg-p02-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p02-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p02-n16-s01/instruction.md b/tasks/agg-p02-n16-s01/instruction.md index 722dd06eb5b0a1781e34a4a84c87448b77da2a59..5e39eb31f3bfe02211382c86f30186b5bbd8d4ba 100644 --- a/tasks/agg-p02-n16-s01/instruction.md +++ b/tasks/agg-p02-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s01/tests/test.sh b/tasks/agg-p02-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s01/tests/test.sh +++ b/tasks/agg-p02-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s02/instruction.md b/tasks/agg-p02-n16-s02/instruction.md index 722dd06eb5b0a1781e34a4a84c87448b77da2a59..5e39eb31f3bfe02211382c86f30186b5bbd8d4ba 100644 --- a/tasks/agg-p02-n16-s02/instruction.md +++ b/tasks/agg-p02-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s02/tests/test.sh b/tasks/agg-p02-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s02/tests/test.sh +++ b/tasks/agg-p02-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s03/instruction.md b/tasks/agg-p02-n16-s03/instruction.md index 689dc52da259912a8583e539c40d32957d6e1982..9e4a131dc1a41521b0b243cd7a381ee18c406e61 100644 --- a/tasks/agg-p02-n16-s03/instruction.md +++ b/tasks/agg-p02-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s03/tests/test.sh b/tasks/agg-p02-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s03/tests/test.sh +++ b/tasks/agg-p02-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s04/instruction.md b/tasks/agg-p02-n16-s04/instruction.md index 81577d14ed82fb21b17e0bd51c9dc2a594f0c1b6..02d90432252450a09c7a989f19e252e75078b8f6 100644 --- a/tasks/agg-p02-n16-s04/instruction.md +++ b/tasks/agg-p02-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s04/tests/test.sh b/tasks/agg-p02-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s04/tests/test.sh +++ b/tasks/agg-p02-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s05/instruction.md b/tasks/agg-p02-n16-s05/instruction.md index 783fbdc57d72bfcadc0344c5e85549aaa9f3efe7..2ea77ca8a72381d318a57abe0da7ab6c0330246a 100644 --- a/tasks/agg-p02-n16-s05/instruction.md +++ b/tasks/agg-p02-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s05/tests/test.sh b/tasks/agg-p02-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s05/tests/test.sh +++ b/tasks/agg-p02-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s06/instruction.md b/tasks/agg-p02-n16-s06/instruction.md index 10bcc3d169e35738b1fb80abb7316f9cd7c1b230..254a759d5a0113deb55448c366676577f275a1f1 100644 --- a/tasks/agg-p02-n16-s06/instruction.md +++ b/tasks/agg-p02-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s06/tests/test.sh b/tasks/agg-p02-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s06/tests/test.sh +++ b/tasks/agg-p02-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s07/instruction.md b/tasks/agg-p02-n16-s07/instruction.md index 07133633c82ade16a43a26c7ec6cacc19d41b3bd..01eccecf7626f9336ce7f443b7b16b6f87314d4c 100644 --- a/tasks/agg-p02-n16-s07/instruction.md +++ b/tasks/agg-p02-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s07/tests/test.sh b/tasks/agg-p02-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s07/tests/test.sh +++ b/tasks/agg-p02-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s08/instruction.md b/tasks/agg-p02-n16-s08/instruction.md index eec0889f35f181e3d5ee370338313f8afc894fe8..741d5c897d7dc6413c1bb96a8b00478c60c908ba 100644 --- a/tasks/agg-p02-n16-s08/instruction.md +++ b/tasks/agg-p02-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s08/tests/test.sh b/tasks/agg-p02-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s08/tests/test.sh +++ b/tasks/agg-p02-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s09/instruction.md b/tasks/agg-p02-n16-s09/instruction.md index 961985392d4b99bbc35d52871fb6450061a34bb5..c98bd62598f64ffcd1b51c3b31ced8e3cda7460c 100644 --- a/tasks/agg-p02-n16-s09/instruction.md +++ b/tasks/agg-p02-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s09/tests/test.sh b/tasks/agg-p02-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s09/tests/test.sh +++ b/tasks/agg-p02-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s10/instruction.md b/tasks/agg-p02-n16-s10/instruction.md index 1fc02ff38c01961e6ef2d04b50e560edacdcca90..1d5113c5dd5abf3bbd4601fe16ab16e11d5a8b7c 100644 --- a/tasks/agg-p02-n16-s10/instruction.md +++ b/tasks/agg-p02-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s10/tests/test.sh b/tasks/agg-p02-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s10/tests/test.sh +++ b/tasks/agg-p02-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s11/instruction.md b/tasks/agg-p02-n16-s11/instruction.md index 3b063473af96559ef580cbc092e75977831e3156..4703f6654b54dad53866503ef64f717d4939884b 100644 --- a/tasks/agg-p02-n16-s11/instruction.md +++ b/tasks/agg-p02-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s11/tests/test.sh b/tasks/agg-p02-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s11/tests/test.sh +++ b/tasks/agg-p02-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s12/instruction.md b/tasks/agg-p02-n16-s12/instruction.md index ac5d07700d94f2ac8dcfe94fa7b7a0669218f24c..b6fbdfaa15c801714d533bc10b7c3a21161186fb 100644 --- a/tasks/agg-p02-n16-s12/instruction.md +++ b/tasks/agg-p02-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s12/tests/test.sh b/tasks/agg-p02-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s12/tests/test.sh +++ b/tasks/agg-p02-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s13/instruction.md b/tasks/agg-p02-n16-s13/instruction.md index 951d8309ecd3f9fbcea5726f506c658fa51c95fe..66045864ad601fbe1194d5fcde0a3bfc9fdbc25b 100644 --- a/tasks/agg-p02-n16-s13/instruction.md +++ b/tasks/agg-p02-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s13/tests/test.sh b/tasks/agg-p02-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s13/tests/test.sh +++ b/tasks/agg-p02-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s14/instruction.md b/tasks/agg-p02-n16-s14/instruction.md index 689dc52da259912a8583e539c40d32957d6e1982..9e4a131dc1a41521b0b243cd7a381ee18c406e61 100644 --- a/tasks/agg-p02-n16-s14/instruction.md +++ b/tasks/agg-p02-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s14/tests/test.sh b/tasks/agg-p02-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s14/tests/test.sh +++ b/tasks/agg-p02-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s15/instruction.md b/tasks/agg-p02-n16-s15/instruction.md index a7f0266a5e6733a93cf24a409665e6e92f793dba..d4d40f859809c8e8513c129e910f96795729f446 100644 --- a/tasks/agg-p02-n16-s15/instruction.md +++ b/tasks/agg-p02-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s15/tests/test.sh b/tasks/agg-p02-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s15/tests/test.sh +++ b/tasks/agg-p02-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p02-n16-s16/instruction.md b/tasks/agg-p02-n16-s16/instruction.md index 9dba8fcd9b2fce59a48316fb46a93570155cc398..fec7193f715ccf2092f0fe956e70ae778f0f8ae7 100644 --- a/tasks/agg-p02-n16-s16/instruction.md +++ b/tasks/agg-p02-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p02-n16-s16/tests/test.sh b/tasks/agg-p02-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p02-n16-s16/tests/test.sh +++ b/tasks/agg-p02-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n01-s01/instruction.md b/tasks/agg-p03-n01-s01/instruction.md index fb95e3a0f91eb38bb8c9a4e7c764b77f18c7d527..eeeb835e5c5f7acc1473f53ace3339a50380e4b2 100644 --- a/tasks/agg-p03-n01-s01/instruction.md +++ b/tasks/agg-p03-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is nineteen. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p03-n01-s01/tests/test.sh b/tasks/agg-p03-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n01-s01/tests/test.sh +++ b/tasks/agg-p03-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n02-s01/instruction.md b/tasks/agg-p03-n02-s01/instruction.md index 1fd513297d4b7083e854d488560de6b474f4bc00..15555153e96a1d750b2d25e8c83257c57ce2d11f 100644 --- a/tasks/agg-p03-n02-s01/instruction.md +++ b/tasks/agg-p03-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n02-s01/tests/test.sh b/tasks/agg-p03-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n02-s01/tests/test.sh +++ b/tasks/agg-p03-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n02-s02/instruction.md b/tasks/agg-p03-n02-s02/instruction.md index 8855a200b99998bb692d78f9988195e4b6878081..b39e6f2f3d2e97af8c5f49f9af170b9e62f31f43 100644 --- a/tasks/agg-p03-n02-s02/instruction.md +++ b/tasks/agg-p03-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n02-s02/tests/test.sh b/tasks/agg-p03-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n02-s02/tests/test.sh +++ b/tasks/agg-p03-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n04-s01/instruction.md b/tasks/agg-p03-n04-s01/instruction.md index 8229ec32a8706beb71697adddf42a1fc48ee812a..0cce0cc72b847f422e9282a2d3dd61a1916d9953 100644 --- a/tasks/agg-p03-n04-s01/instruction.md +++ b/tasks/agg-p03-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n04-s01/tests/test.sh b/tasks/agg-p03-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n04-s01/tests/test.sh +++ b/tasks/agg-p03-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n04-s02/instruction.md b/tasks/agg-p03-n04-s02/instruction.md index da579d533eb385ea7bb2ba5f1bc1ee955fcec441..3a876a7f201bf938aaa56938f8081c628aba37a4 100644 --- a/tasks/agg-p03-n04-s02/instruction.md +++ b/tasks/agg-p03-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n04-s02/tests/test.sh b/tasks/agg-p03-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n04-s02/tests/test.sh +++ b/tasks/agg-p03-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n04-s03/instruction.md b/tasks/agg-p03-n04-s03/instruction.md index 81a0e2fd2e64d966c96d1befbbd673045e4ca524..4b3ef872ced45fb8836a5587cf57951846e2bcff 100644 --- a/tasks/agg-p03-n04-s03/instruction.md +++ b/tasks/agg-p03-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n04-s03/tests/test.sh b/tasks/agg-p03-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n04-s03/tests/test.sh +++ b/tasks/agg-p03-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n04-s04/instruction.md b/tasks/agg-p03-n04-s04/instruction.md index 8024176648825a47cbe8613c954735752817a951..10e568c0f500ae92de8aeab1cb7393eb9ad3b69f 100644 --- a/tasks/agg-p03-n04-s04/instruction.md +++ b/tasks/agg-p03-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n04-s04/tests/test.sh b/tasks/agg-p03-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n04-s04/tests/test.sh +++ b/tasks/agg-p03-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n06-s01/instruction.md b/tasks/agg-p03-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a3162e0c3af58aba4c255d22f35fe5415203df89 --- /dev/null +++ b/tasks/agg-p03-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is nineteen. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n06-s01/solution/solve.sh b/tasks/agg-p03-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..30db8da05f7c057e41204ac8c3c95d59347539e2 --- /dev/null +++ b/tasks/agg-p03-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 55, 81, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n06-s01/task.toml b/tasks/agg-p03-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d7b39c5dfc3d035f4b0c2ac0255b264cdec5b5d9 --- /dev/null +++ b/tasks/agg-p03-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n06-s01/tests/expected.json b/tasks/agg-p03-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..363d8f49bd21d952459e9063a81242b67b73a4e6 --- /dev/null +++ b/tasks/agg-p03-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 55, 81, 89, 92] diff --git a/tasks/agg-p03-n06-s01/tests/test.sh b/tasks/agg-p03-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n06-s02/instruction.md b/tasks/agg-p03-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e2baac9407f25a8a80dbe03ef2a2e62f6f6ad2c1 --- /dev/null +++ b/tasks/agg-p03-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n06-s02/solution/solve.sh b/tasks/agg-p03-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..30db8da05f7c057e41204ac8c3c95d59347539e2 --- /dev/null +++ b/tasks/agg-p03-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 55, 81, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n06-s02/task.toml b/tasks/agg-p03-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..146d862407fafd8bd031fdfa763347e266d73c48 --- /dev/null +++ b/tasks/agg-p03-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n06-s02/tests/expected.json b/tasks/agg-p03-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..363d8f49bd21d952459e9063a81242b67b73a4e6 --- /dev/null +++ b/tasks/agg-p03-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 55, 81, 89, 92] diff --git a/tasks/agg-p03-n06-s02/tests/test.sh b/tasks/agg-p03-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n06-s03/instruction.md b/tasks/agg-p03-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2c7e63e09fb5a7d331c35a5363d54211ebfc3f1e --- /dev/null +++ b/tasks/agg-p03-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n06-s03/solution/solve.sh b/tasks/agg-p03-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..30db8da05f7c057e41204ac8c3c95d59347539e2 --- /dev/null +++ b/tasks/agg-p03-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 55, 81, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n06-s03/task.toml b/tasks/agg-p03-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d571a8e2898ab55f264b1a76efa3f69048808d3b --- /dev/null +++ b/tasks/agg-p03-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n06-s03/tests/expected.json b/tasks/agg-p03-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..363d8f49bd21d952459e9063a81242b67b73a4e6 --- /dev/null +++ b/tasks/agg-p03-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 55, 81, 89, 92] diff --git a/tasks/agg-p03-n06-s03/tests/test.sh b/tasks/agg-p03-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n06-s04/instruction.md b/tasks/agg-p03-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6cdb7b7da1ad956c023ce3608f04299c72876b04 --- /dev/null +++ b/tasks/agg-p03-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n06-s04/solution/solve.sh b/tasks/agg-p03-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..30db8da05f7c057e41204ac8c3c95d59347539e2 --- /dev/null +++ b/tasks/agg-p03-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 55, 81, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n06-s04/task.toml b/tasks/agg-p03-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b1ad48300cb3c5791ada452e0b8a5c262af77c97 --- /dev/null +++ b/tasks/agg-p03-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n06-s04/tests/expected.json b/tasks/agg-p03-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..363d8f49bd21d952459e9063a81242b67b73a4e6 --- /dev/null +++ b/tasks/agg-p03-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 55, 81, 89, 92] diff --git a/tasks/agg-p03-n06-s04/tests/test.sh b/tasks/agg-p03-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n06-s05/instruction.md b/tasks/agg-p03-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a0326b8992e8c1ab2be6d97cef15ae9c5ac1cb46 --- /dev/null +++ b/tasks/agg-p03-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n06-s05/solution/solve.sh b/tasks/agg-p03-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..30db8da05f7c057e41204ac8c3c95d59347539e2 --- /dev/null +++ b/tasks/agg-p03-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 55, 81, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n06-s05/task.toml b/tasks/agg-p03-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..555b7d9a76963b0498d06e4ef131260ebd5c701d --- /dev/null +++ b/tasks/agg-p03-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n06-s05/tests/expected.json b/tasks/agg-p03-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..363d8f49bd21d952459e9063a81242b67b73a4e6 --- /dev/null +++ b/tasks/agg-p03-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 55, 81, 89, 92] diff --git a/tasks/agg-p03-n06-s05/tests/test.sh b/tasks/agg-p03-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n06-s06/instruction.md b/tasks/agg-p03-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..3e1db2c668a1429fe99e57b7aa4909b11c27a8ea --- /dev/null +++ b/tasks/agg-p03-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n06-s06/solution/solve.sh b/tasks/agg-p03-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..30db8da05f7c057e41204ac8c3c95d59347539e2 --- /dev/null +++ b/tasks/agg-p03-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 55, 81, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n06-s06/task.toml b/tasks/agg-p03-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..93b33b0a98df8c3ff704af6914f0a5cdd13d0afe --- /dev/null +++ b/tasks/agg-p03-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n06-s06/tests/expected.json b/tasks/agg-p03-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..363d8f49bd21d952459e9063a81242b67b73a4e6 --- /dev/null +++ b/tasks/agg-p03-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 55, 81, 89, 92] diff --git a/tasks/agg-p03-n06-s06/tests/test.sh b/tasks/agg-p03-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n08-s01/instruction.md b/tasks/agg-p03-n08-s01/instruction.md index e9260e41c83d52ff81d0cd24ab3bbcb722f43da1..002ff3f87af341baf7f43668a34cdab1fe436a4d 100644 --- a/tasks/agg-p03-n08-s01/instruction.md +++ b/tasks/agg-p03-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n08-s01/tests/test.sh b/tasks/agg-p03-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n08-s01/tests/test.sh +++ b/tasks/agg-p03-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n08-s02/instruction.md b/tasks/agg-p03-n08-s02/instruction.md index 2af66d24dc696b132e6fd3eda0188f7a40c90b60..860958efbf695f34e33cd9d04c3d39b09cbfd196 100644 --- a/tasks/agg-p03-n08-s02/instruction.md +++ b/tasks/agg-p03-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n08-s02/tests/test.sh b/tasks/agg-p03-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n08-s02/tests/test.sh +++ b/tasks/agg-p03-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n08-s03/instruction.md b/tasks/agg-p03-n08-s03/instruction.md index 3ef2ec7b4ffc263c27c3bece987fc632ef3cc457..bb55200f8e9216811174b4f1ef5eacfa2a976d3e 100644 --- a/tasks/agg-p03-n08-s03/instruction.md +++ b/tasks/agg-p03-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n08-s03/tests/test.sh b/tasks/agg-p03-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n08-s03/tests/test.sh +++ b/tasks/agg-p03-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n08-s04/instruction.md b/tasks/agg-p03-n08-s04/instruction.md index 868a3b2d9b0dd94351f381b43ce54f12af196c62..a2da9735e6db7e6ac25c3beec2becb49fae9c011 100644 --- a/tasks/agg-p03-n08-s04/instruction.md +++ b/tasks/agg-p03-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n08-s04/tests/test.sh b/tasks/agg-p03-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n08-s04/tests/test.sh +++ b/tasks/agg-p03-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n08-s05/instruction.md b/tasks/agg-p03-n08-s05/instruction.md index 629e2ae1c728c40605589960cbd96dae496187c1..90998e7368407ace103b85ca771303d040de423a 100644 --- a/tasks/agg-p03-n08-s05/instruction.md +++ b/tasks/agg-p03-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n08-s05/tests/test.sh b/tasks/agg-p03-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n08-s05/tests/test.sh +++ b/tasks/agg-p03-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n08-s06/instruction.md b/tasks/agg-p03-n08-s06/instruction.md index cbd8156985f65d76d107221b07326b6deabbfed5..7f6a527995ae5373662b96cfab8f20740ea22c5c 100644 --- a/tasks/agg-p03-n08-s06/instruction.md +++ b/tasks/agg-p03-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n08-s06/tests/test.sh b/tasks/agg-p03-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n08-s06/tests/test.sh +++ b/tasks/agg-p03-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n08-s07/instruction.md b/tasks/agg-p03-n08-s07/instruction.md index 23b58906ee0667ea87049330a38e00438d4f14de..74e668bf3b4713b512ae0c1a24b6253ddea36c40 100644 --- a/tasks/agg-p03-n08-s07/instruction.md +++ b/tasks/agg-p03-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n08-s07/tests/test.sh b/tasks/agg-p03-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n08-s07/tests/test.sh +++ b/tasks/agg-p03-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n08-s08/instruction.md b/tasks/agg-p03-n08-s08/instruction.md index 45b59ec949464e2c81423a8f183e17974a93c05c..b0bcae2eeaf25f778f80af13790eba76351df62c 100644 --- a/tasks/agg-p03-n08-s08/instruction.md +++ b/tasks/agg-p03-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n08-s08/tests/test.sh b/tasks/agg-p03-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n08-s08/tests/test.sh +++ b/tasks/agg-p03-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n12-s01/instruction.md b/tasks/agg-p03-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d20cc8cc1f1c9617a83e07868fc43399bd7b4a36 --- /dev/null +++ b/tasks/agg-p03-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is nineteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n12-s01/solution/solve.sh b/tasks/agg-p03-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..beb24175f773a70fb730375a7020b94fb25ce32f --- /dev/null +++ b/tasks/agg-p03-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n12-s01/task.toml b/tasks/agg-p03-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6879534a4b603476997144c5213acf35a34ad0d6 --- /dev/null +++ b/tasks/agg-p03-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n12-s01/tests/expected.json b/tasks/agg-p03-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..08f9ce8c384c3592131d08695864647179341291 --- /dev/null +++ b/tasks/agg-p03-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92] diff --git a/tasks/agg-p03-n12-s01/tests/test.sh b/tasks/agg-p03-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n12-s02/instruction.md b/tasks/agg-p03-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..83c5f678c22dac3906bb709f049b6407e3c59614 --- /dev/null +++ b/tasks/agg-p03-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n12-s02/solution/solve.sh b/tasks/agg-p03-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..beb24175f773a70fb730375a7020b94fb25ce32f --- /dev/null +++ b/tasks/agg-p03-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n12-s02/task.toml b/tasks/agg-p03-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b11d61fa1ecd88dc1f18dc16098fce2446e05284 --- /dev/null +++ b/tasks/agg-p03-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n12-s02/tests/expected.json b/tasks/agg-p03-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..08f9ce8c384c3592131d08695864647179341291 --- /dev/null +++ b/tasks/agg-p03-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92] diff --git a/tasks/agg-p03-n12-s02/tests/test.sh b/tasks/agg-p03-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n12-s03/instruction.md b/tasks/agg-p03-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0409dcf29dd269b54d93ca84f2b9a827d9cf7d50 --- /dev/null +++ b/tasks/agg-p03-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n12-s03/solution/solve.sh b/tasks/agg-p03-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..beb24175f773a70fb730375a7020b94fb25ce32f --- /dev/null +++ b/tasks/agg-p03-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n12-s03/task.toml b/tasks/agg-p03-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..46feaee39d507ba93a83c1fe697107a9b6ed9ba4 --- /dev/null +++ b/tasks/agg-p03-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n12-s03/tests/expected.json b/tasks/agg-p03-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..08f9ce8c384c3592131d08695864647179341291 --- /dev/null +++ b/tasks/agg-p03-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92] diff --git a/tasks/agg-p03-n12-s03/tests/test.sh b/tasks/agg-p03-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n12-s04/instruction.md b/tasks/agg-p03-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6fa059750b29d2d8c08b5edd7656a2921fb1a9ce --- /dev/null +++ b/tasks/agg-p03-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n12-s04/solution/solve.sh b/tasks/agg-p03-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..beb24175f773a70fb730375a7020b94fb25ce32f --- /dev/null +++ b/tasks/agg-p03-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n12-s04/task.toml b/tasks/agg-p03-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..aa14b13fc2d437f19cdcd3b62a7b87a917dce0e0 --- /dev/null +++ b/tasks/agg-p03-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n12-s04/tests/expected.json b/tasks/agg-p03-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..08f9ce8c384c3592131d08695864647179341291 --- /dev/null +++ b/tasks/agg-p03-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92] diff --git a/tasks/agg-p03-n12-s04/tests/test.sh b/tasks/agg-p03-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n12-s05/instruction.md b/tasks/agg-p03-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..afc44302e5446bbcbad60907a837f2fdde13fc15 --- /dev/null +++ b/tasks/agg-p03-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n12-s05/solution/solve.sh b/tasks/agg-p03-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..beb24175f773a70fb730375a7020b94fb25ce32f --- /dev/null +++ b/tasks/agg-p03-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n12-s05/task.toml b/tasks/agg-p03-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..778b981d09248c5ee9d0ca9bb585684c37bcf460 --- /dev/null +++ b/tasks/agg-p03-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n12-s05/tests/expected.json b/tasks/agg-p03-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..08f9ce8c384c3592131d08695864647179341291 --- /dev/null +++ b/tasks/agg-p03-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92] diff --git a/tasks/agg-p03-n12-s05/tests/test.sh b/tasks/agg-p03-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n12-s06/instruction.md b/tasks/agg-p03-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fb00885ca3bc9d68ddf9fc998c70145bdd52509c --- /dev/null +++ b/tasks/agg-p03-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n12-s06/solution/solve.sh b/tasks/agg-p03-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..beb24175f773a70fb730375a7020b94fb25ce32f --- /dev/null +++ b/tasks/agg-p03-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n12-s06/task.toml b/tasks/agg-p03-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bb7b75533bafb8b5c25000b96d49833d53e7199a --- /dev/null +++ b/tasks/agg-p03-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n12-s06/tests/expected.json b/tasks/agg-p03-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..08f9ce8c384c3592131d08695864647179341291 --- /dev/null +++ b/tasks/agg-p03-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92] diff --git a/tasks/agg-p03-n12-s06/tests/test.sh b/tasks/agg-p03-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n12-s07/instruction.md b/tasks/agg-p03-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4b6846cf5858ebd04826d2b7bdf1b417a38f4471 --- /dev/null +++ b/tasks/agg-p03-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n12-s07/solution/solve.sh b/tasks/agg-p03-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..beb24175f773a70fb730375a7020b94fb25ce32f --- /dev/null +++ b/tasks/agg-p03-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n12-s07/task.toml b/tasks/agg-p03-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..de5a014ad8723994851799e285c38992615da79e --- /dev/null +++ b/tasks/agg-p03-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n12-s07/tests/expected.json b/tasks/agg-p03-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..08f9ce8c384c3592131d08695864647179341291 --- /dev/null +++ b/tasks/agg-p03-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92] diff --git a/tasks/agg-p03-n12-s07/tests/test.sh b/tasks/agg-p03-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n12-s08/instruction.md b/tasks/agg-p03-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..89a1678c978d8a496615bec8d74744ae635b59ec --- /dev/null +++ b/tasks/agg-p03-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n12-s08/solution/solve.sh b/tasks/agg-p03-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..beb24175f773a70fb730375a7020b94fb25ce32f --- /dev/null +++ b/tasks/agg-p03-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n12-s08/task.toml b/tasks/agg-p03-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6d55b53ce9846ba7358a3a854ac10db92db45e39 --- /dev/null +++ b/tasks/agg-p03-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n12-s08/tests/expected.json b/tasks/agg-p03-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..08f9ce8c384c3592131d08695864647179341291 --- /dev/null +++ b/tasks/agg-p03-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92] diff --git a/tasks/agg-p03-n12-s08/tests/test.sh b/tasks/agg-p03-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n12-s09/instruction.md b/tasks/agg-p03-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..894c08d452dd150a471307a3b982c78b62f7152f --- /dev/null +++ b/tasks/agg-p03-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n12-s09/solution/solve.sh b/tasks/agg-p03-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..beb24175f773a70fb730375a7020b94fb25ce32f --- /dev/null +++ b/tasks/agg-p03-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n12-s09/task.toml b/tasks/agg-p03-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b48726e937ff850d8e077f72894af2e274f124fe --- /dev/null +++ b/tasks/agg-p03-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n12-s09/tests/expected.json b/tasks/agg-p03-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..08f9ce8c384c3592131d08695864647179341291 --- /dev/null +++ b/tasks/agg-p03-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92] diff --git a/tasks/agg-p03-n12-s09/tests/test.sh b/tasks/agg-p03-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n12-s10/instruction.md b/tasks/agg-p03-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..054dc42296a82036d581d99f90bd071c5bc61a63 --- /dev/null +++ b/tasks/agg-p03-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n12-s10/solution/solve.sh b/tasks/agg-p03-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..beb24175f773a70fb730375a7020b94fb25ce32f --- /dev/null +++ b/tasks/agg-p03-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n12-s10/task.toml b/tasks/agg-p03-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..dd97bdfbab3672f91c3769702a8e2d175badaba6 --- /dev/null +++ b/tasks/agg-p03-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n12-s10/tests/expected.json b/tasks/agg-p03-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..08f9ce8c384c3592131d08695864647179341291 --- /dev/null +++ b/tasks/agg-p03-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92] diff --git a/tasks/agg-p03-n12-s10/tests/test.sh b/tasks/agg-p03-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n12-s11/instruction.md b/tasks/agg-p03-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f2c76bb45009aa4b02f25d7f7c4771d329f4cb89 --- /dev/null +++ b/tasks/agg-p03-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n12-s11/solution/solve.sh b/tasks/agg-p03-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..beb24175f773a70fb730375a7020b94fb25ce32f --- /dev/null +++ b/tasks/agg-p03-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n12-s11/task.toml b/tasks/agg-p03-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d264f31d95d2188c0ee699ca67af3976553ef171 --- /dev/null +++ b/tasks/agg-p03-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n12-s11/tests/expected.json b/tasks/agg-p03-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..08f9ce8c384c3592131d08695864647179341291 --- /dev/null +++ b/tasks/agg-p03-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92] diff --git a/tasks/agg-p03-n12-s11/tests/test.sh b/tasks/agg-p03-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n12-s12/instruction.md b/tasks/agg-p03-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8cf648eaf9a4f546389931734c87680f9600280c --- /dev/null +++ b/tasks/agg-p03-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n12-s12/solution/solve.sh b/tasks/agg-p03-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..beb24175f773a70fb730375a7020b94fb25ce32f --- /dev/null +++ b/tasks/agg-p03-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92]' > "$answer" diff --git a/tasks/agg-p03-n12-s12/task.toml b/tasks/agg-p03-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6ee6158cdc91eac952467bea7ec83da372ebf31d --- /dev/null +++ b/tasks/agg-p03-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p03-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 3 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p03-n12-s12/tests/expected.json b/tasks/agg-p03-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..08f9ce8c384c3592131d08695864647179341291 --- /dev/null +++ b/tasks/agg-p03-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[2, 19, 26, 32, 43, 55, 68, 78, 81, 83, 89, 92] diff --git a/tasks/agg-p03-n12-s12/tests/test.sh b/tasks/agg-p03-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p03-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p03-n16-s01/instruction.md b/tasks/agg-p03-n16-s01/instruction.md index 689dc52da259912a8583e539c40d32957d6e1982..9e4a131dc1a41521b0b243cd7a381ee18c406e61 100644 --- a/tasks/agg-p03-n16-s01/instruction.md +++ b/tasks/agg-p03-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s01/tests/test.sh b/tasks/agg-p03-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s01/tests/test.sh +++ b/tasks/agg-p03-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s02/instruction.md b/tasks/agg-p03-n16-s02/instruction.md index be22dd060dc917313859b782fc59371588c6eefe..1ae1c83f6310b28c94d56fb3f9788827f371c4c2 100644 --- a/tasks/agg-p03-n16-s02/instruction.md +++ b/tasks/agg-p03-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s02/tests/test.sh b/tasks/agg-p03-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s02/tests/test.sh +++ b/tasks/agg-p03-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s03/instruction.md b/tasks/agg-p03-n16-s03/instruction.md index 33c6e5250952f3077456a896c57a642ebd1c8d39..2ed4d1a65ed8a6a1ef17afdd17d82926d08e7770 100644 --- a/tasks/agg-p03-n16-s03/instruction.md +++ b/tasks/agg-p03-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s03/tests/test.sh b/tasks/agg-p03-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s03/tests/test.sh +++ b/tasks/agg-p03-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s04/instruction.md b/tasks/agg-p03-n16-s04/instruction.md index f686b37d9314f1cebdb92d8ccf24f99b41852805..41b87bc8be3d28d17cbe9b046722f83de0efc15c 100644 --- a/tasks/agg-p03-n16-s04/instruction.md +++ b/tasks/agg-p03-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s04/tests/test.sh b/tasks/agg-p03-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s04/tests/test.sh +++ b/tasks/agg-p03-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s05/instruction.md b/tasks/agg-p03-n16-s05/instruction.md index ebbf18dd1885eca56e4b99d9ba0f301603987c59..967cbe42235491e28138a2858f78709704a1bd82 100644 --- a/tasks/agg-p03-n16-s05/instruction.md +++ b/tasks/agg-p03-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s05/tests/test.sh b/tasks/agg-p03-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s05/tests/test.sh +++ b/tasks/agg-p03-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s06/instruction.md b/tasks/agg-p03-n16-s06/instruction.md index ff35f53eda015951f8078ff0751a783f65818958..e3de5217dbfb10d0002092b53e5f480dfe257ac6 100644 --- a/tasks/agg-p03-n16-s06/instruction.md +++ b/tasks/agg-p03-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s06/tests/test.sh b/tasks/agg-p03-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s06/tests/test.sh +++ b/tasks/agg-p03-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s07/instruction.md b/tasks/agg-p03-n16-s07/instruction.md index 25a3352a6fb27d091e48ef26af1f89bbaefa3612..51708efc2e71807a279f9af965f1a691bfad9276 100644 --- a/tasks/agg-p03-n16-s07/instruction.md +++ b/tasks/agg-p03-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s07/tests/test.sh b/tasks/agg-p03-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s07/tests/test.sh +++ b/tasks/agg-p03-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s08/instruction.md b/tasks/agg-p03-n16-s08/instruction.md index a7f0266a5e6733a93cf24a409665e6e92f793dba..d4d40f859809c8e8513c129e910f96795729f446 100644 --- a/tasks/agg-p03-n16-s08/instruction.md +++ b/tasks/agg-p03-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s08/tests/test.sh b/tasks/agg-p03-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s08/tests/test.sh +++ b/tasks/agg-p03-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s09/instruction.md b/tasks/agg-p03-n16-s09/instruction.md index c0f9d178a1c3057c8c4b57e9c5eca4e4c625b138..efa987bc861271d3fcd4cc6f1530e4d2ecbb6990 100644 --- a/tasks/agg-p03-n16-s09/instruction.md +++ b/tasks/agg-p03-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s09/tests/test.sh b/tasks/agg-p03-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s09/tests/test.sh +++ b/tasks/agg-p03-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s10/instruction.md b/tasks/agg-p03-n16-s10/instruction.md index bd54876511397bdb80a3c3299556503e1fd15da5..ffc3934425adafa34ada41ff5621db5d0f97a3bb 100644 --- a/tasks/agg-p03-n16-s10/instruction.md +++ b/tasks/agg-p03-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s10/tests/test.sh b/tasks/agg-p03-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s10/tests/test.sh +++ b/tasks/agg-p03-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s11/instruction.md b/tasks/agg-p03-n16-s11/instruction.md index 3b063473af96559ef580cbc092e75977831e3156..4703f6654b54dad53866503ef64f717d4939884b 100644 --- a/tasks/agg-p03-n16-s11/instruction.md +++ b/tasks/agg-p03-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s11/tests/test.sh b/tasks/agg-p03-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s11/tests/test.sh +++ b/tasks/agg-p03-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s12/instruction.md b/tasks/agg-p03-n16-s12/instruction.md index c83294206c6f7c5e973e8c218e0400911f653718..eef9c3edc8c0ed8aa6993d11f969e7bfdcc9dd6e 100644 --- a/tasks/agg-p03-n16-s12/instruction.md +++ b/tasks/agg-p03-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s12/tests/test.sh b/tasks/agg-p03-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s12/tests/test.sh +++ b/tasks/agg-p03-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s13/instruction.md b/tasks/agg-p03-n16-s13/instruction.md index ff35f53eda015951f8078ff0751a783f65818958..e3de5217dbfb10d0002092b53e5f480dfe257ac6 100644 --- a/tasks/agg-p03-n16-s13/instruction.md +++ b/tasks/agg-p03-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s13/tests/test.sh b/tasks/agg-p03-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s13/tests/test.sh +++ b/tasks/agg-p03-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s14/instruction.md b/tasks/agg-p03-n16-s14/instruction.md index 552ad7b188277feadeb521fd17ec24a6f1f8f5ae..50bdd007515ead22fc5cdc1b26c44d0d9cdd48d1 100644 --- a/tasks/agg-p03-n16-s14/instruction.md +++ b/tasks/agg-p03-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s14/tests/test.sh b/tasks/agg-p03-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s14/tests/test.sh +++ b/tasks/agg-p03-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s15/instruction.md b/tasks/agg-p03-n16-s15/instruction.md index 3a10e21a080f18532e8e18935bc65496e13588a2..3b81386b59fb88e5b2c11fc6768f76e2b16d0fe9 100644 --- a/tasks/agg-p03-n16-s15/instruction.md +++ b/tasks/agg-p03-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s15/tests/test.sh b/tasks/agg-p03-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s15/tests/test.sh +++ b/tasks/agg-p03-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p03-n16-s16/instruction.md b/tasks/agg-p03-n16-s16/instruction.md index 6b3716855407e49bd1a2d27bc51b41f58fa7bb68..25ebaaacc5fd550a5645a5bd0d6a6adf1dfebf49 100644 --- a/tasks/agg-p03-n16-s16/instruction.md +++ b/tasks/agg-p03-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p03-n16-s16/tests/test.sh b/tasks/agg-p03-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p03-n16-s16/tests/test.sh +++ b/tasks/agg-p03-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n01-s01/instruction.md b/tasks/agg-p04-n01-s01/instruction.md index 94fb1eea0ee202266134436fc623908ddfc125c3..d3ec7a450ab9b95b96f9c3f319db54cc243be73f 100644 --- a/tasks/agg-p04-n01-s01/instruction.md +++ b/tasks/agg-p04-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is thirty-three. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p04-n01-s01/tests/test.sh b/tasks/agg-p04-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n01-s01/tests/test.sh +++ b/tasks/agg-p04-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n02-s01/instruction.md b/tasks/agg-p04-n02-s01/instruction.md index fabd26fc361f6b59ad3563506cc531694f46bf6a..6161d451925057d69d1de4e7235d6810901c9767 100644 --- a/tasks/agg-p04-n02-s01/instruction.md +++ b/tasks/agg-p04-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n02-s01/tests/test.sh b/tasks/agg-p04-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n02-s01/tests/test.sh +++ b/tasks/agg-p04-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n02-s02/instruction.md b/tasks/agg-p04-n02-s02/instruction.md index 0f3615030552b7ad288978a49405ee34f38e6055..1a80d9f89bdbbe8f8977a4e08df746fd30a3d4f2 100644 --- a/tasks/agg-p04-n02-s02/instruction.md +++ b/tasks/agg-p04-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n02-s02/tests/test.sh b/tasks/agg-p04-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n02-s02/tests/test.sh +++ b/tasks/agg-p04-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n04-s01/instruction.md b/tasks/agg-p04-n04-s01/instruction.md index defb2567dbe8012ebceefb3afc2ea1f9ca889d8e..ebe6e8507834a1bb8243353af1201955554e3599 100644 --- a/tasks/agg-p04-n04-s01/instruction.md +++ b/tasks/agg-p04-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n04-s01/tests/test.sh b/tasks/agg-p04-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n04-s01/tests/test.sh +++ b/tasks/agg-p04-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n04-s02/instruction.md b/tasks/agg-p04-n04-s02/instruction.md index 26e139695ec67bfa61fe76d01a807b84861131dd..4741f01efe48d7179ee27b35d655e12f960f4257 100644 --- a/tasks/agg-p04-n04-s02/instruction.md +++ b/tasks/agg-p04-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n04-s02/tests/test.sh b/tasks/agg-p04-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n04-s02/tests/test.sh +++ b/tasks/agg-p04-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n04-s03/instruction.md b/tasks/agg-p04-n04-s03/instruction.md index af29f7ab0f75076509388fa943bdfb4a4c0a5922..ab45d79ba5bf3f1b2a275dd1a83c78ad159fe742 100644 --- a/tasks/agg-p04-n04-s03/instruction.md +++ b/tasks/agg-p04-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n04-s03/tests/test.sh b/tasks/agg-p04-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n04-s03/tests/test.sh +++ b/tasks/agg-p04-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n04-s04/instruction.md b/tasks/agg-p04-n04-s04/instruction.md index 430467a8c33661604553077a8a27e968376d25e5..080d5e6688850a817b1442e6f0fdcbe6a87cf876 100644 --- a/tasks/agg-p04-n04-s04/instruction.md +++ b/tasks/agg-p04-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n04-s04/tests/test.sh b/tasks/agg-p04-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n04-s04/tests/test.sh +++ b/tasks/agg-p04-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n06-s01/instruction.md b/tasks/agg-p04-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b81a4d1b6c939af2f3d24f5e34fcceb0afa2bed5 --- /dev/null +++ b/tasks/agg-p04-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n06-s01/solution/solve.sh b/tasks/agg-p04-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..77d4b007b31aec7894014cdd64baf1882ca1d90a --- /dev/null +++ b/tasks/agg-p04-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 33, 48, 53, 62, 71]' > "$answer" diff --git a/tasks/agg-p04-n06-s01/task.toml b/tasks/agg-p04-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e072aa33daf7fbd8bf498fe966c47426129551e7 --- /dev/null +++ b/tasks/agg-p04-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n06-s01/tests/expected.json b/tasks/agg-p04-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..905a6837dac261c5f9932649cfe47f58a9b869fc --- /dev/null +++ b/tasks/agg-p04-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[25, 33, 48, 53, 62, 71] diff --git a/tasks/agg-p04-n06-s01/tests/test.sh b/tasks/agg-p04-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n06-s02/instruction.md b/tasks/agg-p04-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..41683d53eabd23245dc8e221e343125f96509cc4 --- /dev/null +++ b/tasks/agg-p04-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n06-s02/solution/solve.sh b/tasks/agg-p04-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..77d4b007b31aec7894014cdd64baf1882ca1d90a --- /dev/null +++ b/tasks/agg-p04-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 33, 48, 53, 62, 71]' > "$answer" diff --git a/tasks/agg-p04-n06-s02/task.toml b/tasks/agg-p04-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fead822c7b474dd9486e33028d86f3b0b4e2aa1e --- /dev/null +++ b/tasks/agg-p04-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n06-s02/tests/expected.json b/tasks/agg-p04-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..905a6837dac261c5f9932649cfe47f58a9b869fc --- /dev/null +++ b/tasks/agg-p04-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[25, 33, 48, 53, 62, 71] diff --git a/tasks/agg-p04-n06-s02/tests/test.sh b/tasks/agg-p04-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n06-s03/instruction.md b/tasks/agg-p04-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8b253fb519682bf626feda0158e30db46a4e6c0f --- /dev/null +++ b/tasks/agg-p04-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n06-s03/solution/solve.sh b/tasks/agg-p04-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..77d4b007b31aec7894014cdd64baf1882ca1d90a --- /dev/null +++ b/tasks/agg-p04-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 33, 48, 53, 62, 71]' > "$answer" diff --git a/tasks/agg-p04-n06-s03/task.toml b/tasks/agg-p04-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..258d68a018be0fcb951515e612e3558f091f3fed --- /dev/null +++ b/tasks/agg-p04-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n06-s03/tests/expected.json b/tasks/agg-p04-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..905a6837dac261c5f9932649cfe47f58a9b869fc --- /dev/null +++ b/tasks/agg-p04-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[25, 33, 48, 53, 62, 71] diff --git a/tasks/agg-p04-n06-s03/tests/test.sh b/tasks/agg-p04-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n06-s04/instruction.md b/tasks/agg-p04-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c10b04dc835d0dca589f77fcc2261a294978adf2 --- /dev/null +++ b/tasks/agg-p04-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n06-s04/solution/solve.sh b/tasks/agg-p04-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..77d4b007b31aec7894014cdd64baf1882ca1d90a --- /dev/null +++ b/tasks/agg-p04-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 33, 48, 53, 62, 71]' > "$answer" diff --git a/tasks/agg-p04-n06-s04/task.toml b/tasks/agg-p04-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5b4a0ad8a258e776f57a18baa5b9feec01a7af94 --- /dev/null +++ b/tasks/agg-p04-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n06-s04/tests/expected.json b/tasks/agg-p04-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..905a6837dac261c5f9932649cfe47f58a9b869fc --- /dev/null +++ b/tasks/agg-p04-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[25, 33, 48, 53, 62, 71] diff --git a/tasks/agg-p04-n06-s04/tests/test.sh b/tasks/agg-p04-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n06-s05/instruction.md b/tasks/agg-p04-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f9e883bdc9bff7ab7a0b8faee044c945ab0a1ced --- /dev/null +++ b/tasks/agg-p04-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n06-s05/solution/solve.sh b/tasks/agg-p04-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..77d4b007b31aec7894014cdd64baf1882ca1d90a --- /dev/null +++ b/tasks/agg-p04-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 33, 48, 53, 62, 71]' > "$answer" diff --git a/tasks/agg-p04-n06-s05/task.toml b/tasks/agg-p04-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..66d71394fa3860306d5ac8c080a74239dee7baa5 --- /dev/null +++ b/tasks/agg-p04-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n06-s05/tests/expected.json b/tasks/agg-p04-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..905a6837dac261c5f9932649cfe47f58a9b869fc --- /dev/null +++ b/tasks/agg-p04-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[25, 33, 48, 53, 62, 71] diff --git a/tasks/agg-p04-n06-s05/tests/test.sh b/tasks/agg-p04-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n06-s06/instruction.md b/tasks/agg-p04-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d127d29184f6fa8e30fc3dc698ba4c5c5b50aba8 --- /dev/null +++ b/tasks/agg-p04-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n06-s06/solution/solve.sh b/tasks/agg-p04-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..77d4b007b31aec7894014cdd64baf1882ca1d90a --- /dev/null +++ b/tasks/agg-p04-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 33, 48, 53, 62, 71]' > "$answer" diff --git a/tasks/agg-p04-n06-s06/task.toml b/tasks/agg-p04-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..172e7f66064378b68ae5bfce5fdb55362fc533e4 --- /dev/null +++ b/tasks/agg-p04-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n06-s06/tests/expected.json b/tasks/agg-p04-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..905a6837dac261c5f9932649cfe47f58a9b869fc --- /dev/null +++ b/tasks/agg-p04-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[25, 33, 48, 53, 62, 71] diff --git a/tasks/agg-p04-n06-s06/tests/test.sh b/tasks/agg-p04-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n08-s01/instruction.md b/tasks/agg-p04-n08-s01/instruction.md index 03c94df8689da4f5b0401f4f3decef651eb9aee0..f59205650a10f9897e7be3c7465c8741b50c1c70 100644 --- a/tasks/agg-p04-n08-s01/instruction.md +++ b/tasks/agg-p04-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n08-s01/tests/test.sh b/tasks/agg-p04-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n08-s01/tests/test.sh +++ b/tasks/agg-p04-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n08-s02/instruction.md b/tasks/agg-p04-n08-s02/instruction.md index fb0fbc43bc72c36371a3de146c4ffbb7a4304417..838413aa41b8e4bf70f97dc35ce6f9f74b85f116 100644 --- a/tasks/agg-p04-n08-s02/instruction.md +++ b/tasks/agg-p04-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n08-s02/tests/test.sh b/tasks/agg-p04-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n08-s02/tests/test.sh +++ b/tasks/agg-p04-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n08-s03/instruction.md b/tasks/agg-p04-n08-s03/instruction.md index 9aeda7c18bda7e04cdb2b969682a97e7b7f2d3d5..c2e03bf5ff942c738d8c8b507766fe8a789de295 100644 --- a/tasks/agg-p04-n08-s03/instruction.md +++ b/tasks/agg-p04-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n08-s03/tests/test.sh b/tasks/agg-p04-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n08-s03/tests/test.sh +++ b/tasks/agg-p04-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n08-s04/instruction.md b/tasks/agg-p04-n08-s04/instruction.md index b972a48112ea31bbb92b19d1817bc5119ac04601..f5506dd4b4102b3440ace8d4668dab6d0b4cb826 100644 --- a/tasks/agg-p04-n08-s04/instruction.md +++ b/tasks/agg-p04-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n08-s04/tests/test.sh b/tasks/agg-p04-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n08-s04/tests/test.sh +++ b/tasks/agg-p04-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n08-s05/instruction.md b/tasks/agg-p04-n08-s05/instruction.md index eee7a0b5f66fc3863f0f9be834031a101d16805b..e18ab9027af739e0c6a8e15c489ac72b51badfe0 100644 --- a/tasks/agg-p04-n08-s05/instruction.md +++ b/tasks/agg-p04-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n08-s05/tests/test.sh b/tasks/agg-p04-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n08-s05/tests/test.sh +++ b/tasks/agg-p04-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n08-s06/instruction.md b/tasks/agg-p04-n08-s06/instruction.md index 1479c41de00fbbd2d26aad2aee1e7ce486083215..0112dc65c46753b81674029d63466bce37601f3f 100644 --- a/tasks/agg-p04-n08-s06/instruction.md +++ b/tasks/agg-p04-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n08-s06/tests/test.sh b/tasks/agg-p04-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n08-s06/tests/test.sh +++ b/tasks/agg-p04-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n08-s07/instruction.md b/tasks/agg-p04-n08-s07/instruction.md index 33c7a00b4080f6f53fe6a6a1b5309b10579c3bc5..10415d93cfa0d6d1cfe2741b569ed7f93bc629a9 100644 --- a/tasks/agg-p04-n08-s07/instruction.md +++ b/tasks/agg-p04-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n08-s07/tests/test.sh b/tasks/agg-p04-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n08-s07/tests/test.sh +++ b/tasks/agg-p04-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n08-s08/instruction.md b/tasks/agg-p04-n08-s08/instruction.md index 3d680c6e106b56337740b69832fd529620869a7a..a26b636fa2fb13a4ac045458776319e1348e3b1a 100644 --- a/tasks/agg-p04-n08-s08/instruction.md +++ b/tasks/agg-p04-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n08-s08/tests/test.sh b/tasks/agg-p04-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n08-s08/tests/test.sh +++ b/tasks/agg-p04-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n12-s01/instruction.md b/tasks/agg-p04-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ac4ab97ac5016f85469b1949304d6955bc5c5cdc --- /dev/null +++ b/tasks/agg-p04-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n12-s01/solution/solve.sh b/tasks/agg-p04-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4829b03ce3d1358205049e4830d9f0cba0519b60 --- /dev/null +++ b/tasks/agg-p04-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97]' > "$answer" diff --git a/tasks/agg-p04-n12-s01/task.toml b/tasks/agg-p04-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e42d65cc42d7b354998a15866c2fcc4687a5b0d0 --- /dev/null +++ b/tasks/agg-p04-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n12-s01/tests/expected.json b/tasks/agg-p04-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f17684fb24c00cf59dcf1941e379f82479115755 --- /dev/null +++ b/tasks/agg-p04-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97] diff --git a/tasks/agg-p04-n12-s01/tests/test.sh b/tasks/agg-p04-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n12-s02/instruction.md b/tasks/agg-p04-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..619b52b72dd0e0fb5294f24176b256347b8b4527 --- /dev/null +++ b/tasks/agg-p04-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n12-s02/solution/solve.sh b/tasks/agg-p04-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4829b03ce3d1358205049e4830d9f0cba0519b60 --- /dev/null +++ b/tasks/agg-p04-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97]' > "$answer" diff --git a/tasks/agg-p04-n12-s02/task.toml b/tasks/agg-p04-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..dd7c78ad446fb7c8324ec9d7a097314173c1a54c --- /dev/null +++ b/tasks/agg-p04-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n12-s02/tests/expected.json b/tasks/agg-p04-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f17684fb24c00cf59dcf1941e379f82479115755 --- /dev/null +++ b/tasks/agg-p04-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97] diff --git a/tasks/agg-p04-n12-s02/tests/test.sh b/tasks/agg-p04-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n12-s03/instruction.md b/tasks/agg-p04-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c8f325be4d0da26c010644a3007675a0c695c534 --- /dev/null +++ b/tasks/agg-p04-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n12-s03/solution/solve.sh b/tasks/agg-p04-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4829b03ce3d1358205049e4830d9f0cba0519b60 --- /dev/null +++ b/tasks/agg-p04-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97]' > "$answer" diff --git a/tasks/agg-p04-n12-s03/task.toml b/tasks/agg-p04-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e7dbd408297b0290202395864712770cda2daeac --- /dev/null +++ b/tasks/agg-p04-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n12-s03/tests/expected.json b/tasks/agg-p04-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f17684fb24c00cf59dcf1941e379f82479115755 --- /dev/null +++ b/tasks/agg-p04-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97] diff --git a/tasks/agg-p04-n12-s03/tests/test.sh b/tasks/agg-p04-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n12-s04/instruction.md b/tasks/agg-p04-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6f3f8fe41060e201182cc94c7cf026320c69b36b --- /dev/null +++ b/tasks/agg-p04-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n12-s04/solution/solve.sh b/tasks/agg-p04-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4829b03ce3d1358205049e4830d9f0cba0519b60 --- /dev/null +++ b/tasks/agg-p04-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97]' > "$answer" diff --git a/tasks/agg-p04-n12-s04/task.toml b/tasks/agg-p04-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..294040e27158b0358806a9e304d1b7af8ef78f0c --- /dev/null +++ b/tasks/agg-p04-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n12-s04/tests/expected.json b/tasks/agg-p04-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f17684fb24c00cf59dcf1941e379f82479115755 --- /dev/null +++ b/tasks/agg-p04-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97] diff --git a/tasks/agg-p04-n12-s04/tests/test.sh b/tasks/agg-p04-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n12-s05/instruction.md b/tasks/agg-p04-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..297e7df5ad0e1e0ae0182d7fbd8be00d892a2f7e --- /dev/null +++ b/tasks/agg-p04-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n12-s05/solution/solve.sh b/tasks/agg-p04-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4829b03ce3d1358205049e4830d9f0cba0519b60 --- /dev/null +++ b/tasks/agg-p04-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97]' > "$answer" diff --git a/tasks/agg-p04-n12-s05/task.toml b/tasks/agg-p04-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a2c2f30b4dcd69c76c137466861cd6478c18dd21 --- /dev/null +++ b/tasks/agg-p04-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n12-s05/tests/expected.json b/tasks/agg-p04-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f17684fb24c00cf59dcf1941e379f82479115755 --- /dev/null +++ b/tasks/agg-p04-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97] diff --git a/tasks/agg-p04-n12-s05/tests/test.sh b/tasks/agg-p04-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n12-s06/instruction.md b/tasks/agg-p04-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f378b007e7f5cf7bb24628ed10ac1fe1824109b7 --- /dev/null +++ b/tasks/agg-p04-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n12-s06/solution/solve.sh b/tasks/agg-p04-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4829b03ce3d1358205049e4830d9f0cba0519b60 --- /dev/null +++ b/tasks/agg-p04-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97]' > "$answer" diff --git a/tasks/agg-p04-n12-s06/task.toml b/tasks/agg-p04-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8d6bac8f954c7dab7facc276ba92574f07823045 --- /dev/null +++ b/tasks/agg-p04-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n12-s06/tests/expected.json b/tasks/agg-p04-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f17684fb24c00cf59dcf1941e379f82479115755 --- /dev/null +++ b/tasks/agg-p04-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97] diff --git a/tasks/agg-p04-n12-s06/tests/test.sh b/tasks/agg-p04-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n12-s07/instruction.md b/tasks/agg-p04-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..031c703efd3d4ee9d7e52a3211272bdd8fdb3bc4 --- /dev/null +++ b/tasks/agg-p04-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n12-s07/solution/solve.sh b/tasks/agg-p04-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4829b03ce3d1358205049e4830d9f0cba0519b60 --- /dev/null +++ b/tasks/agg-p04-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97]' > "$answer" diff --git a/tasks/agg-p04-n12-s07/task.toml b/tasks/agg-p04-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0430059a2d88c80c7fa14a5c3f3bbe7bc5b90d42 --- /dev/null +++ b/tasks/agg-p04-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n12-s07/tests/expected.json b/tasks/agg-p04-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f17684fb24c00cf59dcf1941e379f82479115755 --- /dev/null +++ b/tasks/agg-p04-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97] diff --git a/tasks/agg-p04-n12-s07/tests/test.sh b/tasks/agg-p04-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n12-s08/instruction.md b/tasks/agg-p04-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..af43acb9caba28ebabccb04957da32e506624fbb --- /dev/null +++ b/tasks/agg-p04-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n12-s08/solution/solve.sh b/tasks/agg-p04-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4829b03ce3d1358205049e4830d9f0cba0519b60 --- /dev/null +++ b/tasks/agg-p04-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97]' > "$answer" diff --git a/tasks/agg-p04-n12-s08/task.toml b/tasks/agg-p04-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..709b526f1b023b21cb260dcf913f90a65782e27f --- /dev/null +++ b/tasks/agg-p04-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n12-s08/tests/expected.json b/tasks/agg-p04-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f17684fb24c00cf59dcf1941e379f82479115755 --- /dev/null +++ b/tasks/agg-p04-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97] diff --git a/tasks/agg-p04-n12-s08/tests/test.sh b/tasks/agg-p04-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n12-s09/instruction.md b/tasks/agg-p04-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..60de2988fff25a8c1506580c1ef0e053a02c16f7 --- /dev/null +++ b/tasks/agg-p04-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n12-s09/solution/solve.sh b/tasks/agg-p04-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4829b03ce3d1358205049e4830d9f0cba0519b60 --- /dev/null +++ b/tasks/agg-p04-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97]' > "$answer" diff --git a/tasks/agg-p04-n12-s09/task.toml b/tasks/agg-p04-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..30f49d3dfffd7caa8480a07c1b89864501de0ba0 --- /dev/null +++ b/tasks/agg-p04-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n12-s09/tests/expected.json b/tasks/agg-p04-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f17684fb24c00cf59dcf1941e379f82479115755 --- /dev/null +++ b/tasks/agg-p04-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97] diff --git a/tasks/agg-p04-n12-s09/tests/test.sh b/tasks/agg-p04-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n12-s10/instruction.md b/tasks/agg-p04-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..710a88fca3c54632b531e8326d63c5a443adad46 --- /dev/null +++ b/tasks/agg-p04-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n12-s10/solution/solve.sh b/tasks/agg-p04-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4829b03ce3d1358205049e4830d9f0cba0519b60 --- /dev/null +++ b/tasks/agg-p04-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97]' > "$answer" diff --git a/tasks/agg-p04-n12-s10/task.toml b/tasks/agg-p04-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b3befaa1bc0451dc5b5000f94d561acd363d52d3 --- /dev/null +++ b/tasks/agg-p04-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n12-s10/tests/expected.json b/tasks/agg-p04-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f17684fb24c00cf59dcf1941e379f82479115755 --- /dev/null +++ b/tasks/agg-p04-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97] diff --git a/tasks/agg-p04-n12-s10/tests/test.sh b/tasks/agg-p04-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n12-s11/instruction.md b/tasks/agg-p04-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..02901bb1828d807a2d28e8fb148344dbe048c353 --- /dev/null +++ b/tasks/agg-p04-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n12-s11/solution/solve.sh b/tasks/agg-p04-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4829b03ce3d1358205049e4830d9f0cba0519b60 --- /dev/null +++ b/tasks/agg-p04-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97]' > "$answer" diff --git a/tasks/agg-p04-n12-s11/task.toml b/tasks/agg-p04-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1a45f2f7b23a4275c8d5a5f40ac597acc55b7941 --- /dev/null +++ b/tasks/agg-p04-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n12-s11/tests/expected.json b/tasks/agg-p04-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f17684fb24c00cf59dcf1941e379f82479115755 --- /dev/null +++ b/tasks/agg-p04-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97] diff --git a/tasks/agg-p04-n12-s11/tests/test.sh b/tasks/agg-p04-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n12-s12/instruction.md b/tasks/agg-p04-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f4b49efc3c821e0d716e0443cac99bdb036d4e81 --- /dev/null +++ b/tasks/agg-p04-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n12-s12/solution/solve.sh b/tasks/agg-p04-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4829b03ce3d1358205049e4830d9f0cba0519b60 --- /dev/null +++ b/tasks/agg-p04-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97]' > "$answer" diff --git a/tasks/agg-p04-n12-s12/task.toml b/tasks/agg-p04-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..afde3e5eaad54867824186f035f315f84fb53fdc --- /dev/null +++ b/tasks/agg-p04-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p04-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 4 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p04-n12-s12/tests/expected.json b/tasks/agg-p04-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f17684fb24c00cf59dcf1941e379f82479115755 --- /dev/null +++ b/tasks/agg-p04-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[24, 25, 33, 44, 48, 53, 62, 71, 77, 87, 90, 97] diff --git a/tasks/agg-p04-n12-s12/tests/test.sh b/tasks/agg-p04-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p04-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p04-n16-s01/instruction.md b/tasks/agg-p04-n16-s01/instruction.md index d92b3c67aa869a2b7ccb0b74ca78af94faae0b02..671a8ab2cae28823934c021dcf645fc4038d0570 100644 --- a/tasks/agg-p04-n16-s01/instruction.md +++ b/tasks/agg-p04-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s01/tests/test.sh b/tasks/agg-p04-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s01/tests/test.sh +++ b/tasks/agg-p04-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s02/instruction.md b/tasks/agg-p04-n16-s02/instruction.md index d019999eecd81b0d102088ffd8dc6702e314773f..0800edc3b640ede26ab3978765dad5c40d1446ad 100644 --- a/tasks/agg-p04-n16-s02/instruction.md +++ b/tasks/agg-p04-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s02/tests/test.sh b/tasks/agg-p04-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s02/tests/test.sh +++ b/tasks/agg-p04-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s03/instruction.md b/tasks/agg-p04-n16-s03/instruction.md index 38e83aee5771fa00d5091767999e55e04acb180b..faf993ab529fff7ee5de3df9b24769934f987d78 100644 --- a/tasks/agg-p04-n16-s03/instruction.md +++ b/tasks/agg-p04-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s03/tests/test.sh b/tasks/agg-p04-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s03/tests/test.sh +++ b/tasks/agg-p04-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s04/instruction.md b/tasks/agg-p04-n16-s04/instruction.md index 722dd06eb5b0a1781e34a4a84c87448b77da2a59..5e39eb31f3bfe02211382c86f30186b5bbd8d4ba 100644 --- a/tasks/agg-p04-n16-s04/instruction.md +++ b/tasks/agg-p04-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s04/tests/test.sh b/tasks/agg-p04-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s04/tests/test.sh +++ b/tasks/agg-p04-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s05/instruction.md b/tasks/agg-p04-n16-s05/instruction.md index 04c3f6729149d2802728807768786a453bb32941..66fed180f5ece962b8f35828f82d008e1814560f 100644 --- a/tasks/agg-p04-n16-s05/instruction.md +++ b/tasks/agg-p04-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s05/tests/test.sh b/tasks/agg-p04-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s05/tests/test.sh +++ b/tasks/agg-p04-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s06/instruction.md b/tasks/agg-p04-n16-s06/instruction.md index 81fbf2c2720ed316086419e84cc080153e8dc4cd..2c7e0125bf7b6189a66b80f4f9f491784a6708e4 100644 --- a/tasks/agg-p04-n16-s06/instruction.md +++ b/tasks/agg-p04-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s06/tests/test.sh b/tasks/agg-p04-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s06/tests/test.sh +++ b/tasks/agg-p04-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s07/instruction.md b/tasks/agg-p04-n16-s07/instruction.md index 3c1a8c1b0c33b8354227b277a5b1885c3067b4d2..6a9948c4088c17e7b78a078e0010c060500c2e8e 100644 --- a/tasks/agg-p04-n16-s07/instruction.md +++ b/tasks/agg-p04-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s07/tests/test.sh b/tasks/agg-p04-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s07/tests/test.sh +++ b/tasks/agg-p04-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s08/instruction.md b/tasks/agg-p04-n16-s08/instruction.md index dd18e619980c2687fe4772d260bb316eee4672ae..e436f47e8c4723ef51db85ae04ee5cefa6717429 100644 --- a/tasks/agg-p04-n16-s08/instruction.md +++ b/tasks/agg-p04-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s08/tests/test.sh b/tasks/agg-p04-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s08/tests/test.sh +++ b/tasks/agg-p04-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s09/instruction.md b/tasks/agg-p04-n16-s09/instruction.md index a31300409e75190524f2a237c2d0d6348715dc53..106160b98d71014a9eaa408fdaab716f872544a2 100644 --- a/tasks/agg-p04-n16-s09/instruction.md +++ b/tasks/agg-p04-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s09/tests/test.sh b/tasks/agg-p04-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s09/tests/test.sh +++ b/tasks/agg-p04-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s10/instruction.md b/tasks/agg-p04-n16-s10/instruction.md index 951d8309ecd3f9fbcea5726f506c658fa51c95fe..66045864ad601fbe1194d5fcde0a3bfc9fdbc25b 100644 --- a/tasks/agg-p04-n16-s10/instruction.md +++ b/tasks/agg-p04-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s10/tests/test.sh b/tasks/agg-p04-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s10/tests/test.sh +++ b/tasks/agg-p04-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s11/instruction.md b/tasks/agg-p04-n16-s11/instruction.md index 2b88f98c808d50d8812e112db76251266368fe80..3162a9d23282256e321282ae9170e9de281da28f 100644 --- a/tasks/agg-p04-n16-s11/instruction.md +++ b/tasks/agg-p04-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s11/tests/test.sh b/tasks/agg-p04-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s11/tests/test.sh +++ b/tasks/agg-p04-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s12/instruction.md b/tasks/agg-p04-n16-s12/instruction.md index 3a10e21a080f18532e8e18935bc65496e13588a2..3b81386b59fb88e5b2c11fc6768f76e2b16d0fe9 100644 --- a/tasks/agg-p04-n16-s12/instruction.md +++ b/tasks/agg-p04-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s12/tests/test.sh b/tasks/agg-p04-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s12/tests/test.sh +++ b/tasks/agg-p04-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s13/instruction.md b/tasks/agg-p04-n16-s13/instruction.md index f9807e3dca090e22409202efda192d4a7b9f5ac5..f9190cd6f2d679efa59828aa0ffdff708c0d41ce 100644 --- a/tasks/agg-p04-n16-s13/instruction.md +++ b/tasks/agg-p04-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s13/tests/test.sh b/tasks/agg-p04-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s13/tests/test.sh +++ b/tasks/agg-p04-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s14/instruction.md b/tasks/agg-p04-n16-s14/instruction.md index 6d104365f5a2f721f3137e68a5cce07413cc5159..851ed8ff280ad3585c357918d2ff37530bb65f69 100644 --- a/tasks/agg-p04-n16-s14/instruction.md +++ b/tasks/agg-p04-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s14/tests/test.sh b/tasks/agg-p04-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s14/tests/test.sh +++ b/tasks/agg-p04-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s15/instruction.md b/tasks/agg-p04-n16-s15/instruction.md index 961985392d4b99bbc35d52871fb6450061a34bb5..c98bd62598f64ffcd1b51c3b31ced8e3cda7460c 100644 --- a/tasks/agg-p04-n16-s15/instruction.md +++ b/tasks/agg-p04-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s15/tests/test.sh b/tasks/agg-p04-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s15/tests/test.sh +++ b/tasks/agg-p04-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p04-n16-s16/instruction.md b/tasks/agg-p04-n16-s16/instruction.md index bb8416d585abe15f78ad9eaf98f78cbb202e2f9a..d2b26950540de67dd00f1a8d6c3d9b9c9c52ddf0 100644 --- a/tasks/agg-p04-n16-s16/instruction.md +++ b/tasks/agg-p04-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p04-n16-s16/tests/test.sh b/tasks/agg-p04-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p04-n16-s16/tests/test.sh +++ b/tasks/agg-p04-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n01-s01/instruction.md b/tasks/agg-p05-n01-s01/instruction.md index 0568bc2af1d88c90277511faf487cc58ac45877d..ffbb01485ae3ad1f8304bf85ff48b1d6a2f13934 100644 --- a/tasks/agg-p05-n01-s01/instruction.md +++ b/tasks/agg-p05-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is eighty-seven. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p05-n01-s01/tests/test.sh b/tasks/agg-p05-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n01-s01/tests/test.sh +++ b/tasks/agg-p05-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n02-s01/instruction.md b/tasks/agg-p05-n02-s01/instruction.md index 68132a2ea4eff0312994ba245cff48e96ee274f6..9648bea229cc435b1c90b6f6ecee2f244390efb6 100644 --- a/tasks/agg-p05-n02-s01/instruction.md +++ b/tasks/agg-p05-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n02-s01/tests/test.sh b/tasks/agg-p05-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n02-s01/tests/test.sh +++ b/tasks/agg-p05-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n02-s02/instruction.md b/tasks/agg-p05-n02-s02/instruction.md index ec0561d67e0d5dc54152dd0017d91fe60a9ddef3..89a41edbabc7f286d18311112571e82b20718d48 100644 --- a/tasks/agg-p05-n02-s02/instruction.md +++ b/tasks/agg-p05-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n02-s02/tests/test.sh b/tasks/agg-p05-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n02-s02/tests/test.sh +++ b/tasks/agg-p05-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n04-s01/instruction.md b/tasks/agg-p05-n04-s01/instruction.md index fc572c6b324e9085b5f8d2ad8e16073f218d2ac2..50320cae9caf38879862a31a2b92c54c890a5fa0 100644 --- a/tasks/agg-p05-n04-s01/instruction.md +++ b/tasks/agg-p05-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n04-s01/tests/test.sh b/tasks/agg-p05-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n04-s01/tests/test.sh +++ b/tasks/agg-p05-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n04-s02/instruction.md b/tasks/agg-p05-n04-s02/instruction.md index 0f59f042353e4786e2a6604ea91abb595858dde5..edf7a1b76e1784ba77d0f4abbe7813d553c3e31a 100644 --- a/tasks/agg-p05-n04-s02/instruction.md +++ b/tasks/agg-p05-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n04-s02/tests/test.sh b/tasks/agg-p05-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n04-s02/tests/test.sh +++ b/tasks/agg-p05-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n04-s03/instruction.md b/tasks/agg-p05-n04-s03/instruction.md index e7542f9907e91df21fab2124076c6c696721d957..4baf7eb09763c5d01dc2bed2ab8424c63b18b390 100644 --- a/tasks/agg-p05-n04-s03/instruction.md +++ b/tasks/agg-p05-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n04-s03/tests/test.sh b/tasks/agg-p05-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n04-s03/tests/test.sh +++ b/tasks/agg-p05-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n04-s04/instruction.md b/tasks/agg-p05-n04-s04/instruction.md index 35d1afd72cf600540907b19cc7d078cb47d28575..8618ca7ba6b2772a607c481c7f8b5a903ba8794b 100644 --- a/tasks/agg-p05-n04-s04/instruction.md +++ b/tasks/agg-p05-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n04-s04/tests/test.sh b/tasks/agg-p05-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n04-s04/tests/test.sh +++ b/tasks/agg-p05-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n06-s01/instruction.md b/tasks/agg-p05-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9ada7a9fb4e9782cb007402e39cce8e26a9a4090 --- /dev/null +++ b/tasks/agg-p05-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n06-s01/solution/solve.sh b/tasks/agg-p05-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..864d8eb0a9ea99fef2beaf69e0dbfaff39f3150e --- /dev/null +++ b/tasks/agg-p05-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 40, 57, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n06-s01/task.toml b/tasks/agg-p05-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..83716df3872f50eb305c1df13314e4dfabcb2bef --- /dev/null +++ b/tasks/agg-p05-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n06-s01/tests/expected.json b/tasks/agg-p05-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..61fdaf3d146c93ad37c2a2a16f2a0cadfea9c87c --- /dev/null +++ b/tasks/agg-p05-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[25, 40, 57, 87, 93, 96] diff --git a/tasks/agg-p05-n06-s01/tests/test.sh b/tasks/agg-p05-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n06-s02/instruction.md b/tasks/agg-p05-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..158e077f5ecc23ac4b07b36526abf582ae9a7810 --- /dev/null +++ b/tasks/agg-p05-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n06-s02/solution/solve.sh b/tasks/agg-p05-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..864d8eb0a9ea99fef2beaf69e0dbfaff39f3150e --- /dev/null +++ b/tasks/agg-p05-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 40, 57, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n06-s02/task.toml b/tasks/agg-p05-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b386aa0e164a384ded4c02cd5fb5ac28839f8bc9 --- /dev/null +++ b/tasks/agg-p05-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n06-s02/tests/expected.json b/tasks/agg-p05-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..61fdaf3d146c93ad37c2a2a16f2a0cadfea9c87c --- /dev/null +++ b/tasks/agg-p05-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[25, 40, 57, 87, 93, 96] diff --git a/tasks/agg-p05-n06-s02/tests/test.sh b/tasks/agg-p05-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n06-s03/instruction.md b/tasks/agg-p05-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e2642e0859dd76f903fc071cc1b01cbcbfcf6db4 --- /dev/null +++ b/tasks/agg-p05-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n06-s03/solution/solve.sh b/tasks/agg-p05-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..864d8eb0a9ea99fef2beaf69e0dbfaff39f3150e --- /dev/null +++ b/tasks/agg-p05-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 40, 57, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n06-s03/task.toml b/tasks/agg-p05-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ee7c261feb7029f7e811ecdfa0339a20d3b37696 --- /dev/null +++ b/tasks/agg-p05-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n06-s03/tests/expected.json b/tasks/agg-p05-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..61fdaf3d146c93ad37c2a2a16f2a0cadfea9c87c --- /dev/null +++ b/tasks/agg-p05-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[25, 40, 57, 87, 93, 96] diff --git a/tasks/agg-p05-n06-s03/tests/test.sh b/tasks/agg-p05-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n06-s04/instruction.md b/tasks/agg-p05-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..28b2e9647b1848ba7e1eabdb72052ac17b1ace6c --- /dev/null +++ b/tasks/agg-p05-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n06-s04/solution/solve.sh b/tasks/agg-p05-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..864d8eb0a9ea99fef2beaf69e0dbfaff39f3150e --- /dev/null +++ b/tasks/agg-p05-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 40, 57, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n06-s04/task.toml b/tasks/agg-p05-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1a2d379a541dd5afa18e106c7985350b2927bb92 --- /dev/null +++ b/tasks/agg-p05-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n06-s04/tests/expected.json b/tasks/agg-p05-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..61fdaf3d146c93ad37c2a2a16f2a0cadfea9c87c --- /dev/null +++ b/tasks/agg-p05-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[25, 40, 57, 87, 93, 96] diff --git a/tasks/agg-p05-n06-s04/tests/test.sh b/tasks/agg-p05-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n06-s05/instruction.md b/tasks/agg-p05-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a85f12b18f520ed02306f7601d3daf87529d5788 --- /dev/null +++ b/tasks/agg-p05-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n06-s05/solution/solve.sh b/tasks/agg-p05-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..864d8eb0a9ea99fef2beaf69e0dbfaff39f3150e --- /dev/null +++ b/tasks/agg-p05-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 40, 57, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n06-s05/task.toml b/tasks/agg-p05-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0f2fc01f29e3d658272d37c151babe59c725bb77 --- /dev/null +++ b/tasks/agg-p05-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n06-s05/tests/expected.json b/tasks/agg-p05-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..61fdaf3d146c93ad37c2a2a16f2a0cadfea9c87c --- /dev/null +++ b/tasks/agg-p05-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[25, 40, 57, 87, 93, 96] diff --git a/tasks/agg-p05-n06-s05/tests/test.sh b/tasks/agg-p05-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n06-s06/instruction.md b/tasks/agg-p05-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f9e883bdc9bff7ab7a0b8faee044c945ab0a1ced --- /dev/null +++ b/tasks/agg-p05-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n06-s06/solution/solve.sh b/tasks/agg-p05-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..864d8eb0a9ea99fef2beaf69e0dbfaff39f3150e --- /dev/null +++ b/tasks/agg-p05-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 40, 57, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n06-s06/task.toml b/tasks/agg-p05-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8808684eba6873259d111852fd597a7002267fe9 --- /dev/null +++ b/tasks/agg-p05-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n06-s06/tests/expected.json b/tasks/agg-p05-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..61fdaf3d146c93ad37c2a2a16f2a0cadfea9c87c --- /dev/null +++ b/tasks/agg-p05-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[25, 40, 57, 87, 93, 96] diff --git a/tasks/agg-p05-n06-s06/tests/test.sh b/tasks/agg-p05-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n08-s01/instruction.md b/tasks/agg-p05-n08-s01/instruction.md index 33c7a00b4080f6f53fe6a6a1b5309b10579c3bc5..10415d93cfa0d6d1cfe2741b569ed7f93bc629a9 100644 --- a/tasks/agg-p05-n08-s01/instruction.md +++ b/tasks/agg-p05-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n08-s01/tests/test.sh b/tasks/agg-p05-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n08-s01/tests/test.sh +++ b/tasks/agg-p05-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n08-s02/instruction.md b/tasks/agg-p05-n08-s02/instruction.md index 183578f4cd202fb917e5afc71715cf45b333a146..7badc85237e412bda6e80a246cad7fb5790e34e3 100644 --- a/tasks/agg-p05-n08-s02/instruction.md +++ b/tasks/agg-p05-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n08-s02/tests/test.sh b/tasks/agg-p05-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n08-s02/tests/test.sh +++ b/tasks/agg-p05-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n08-s03/instruction.md b/tasks/agg-p05-n08-s03/instruction.md index 56807e7ffd4a14fa2eb5273545b96cb70247a2f9..b641b4cc347e165e34603570096d389d9673035a 100644 --- a/tasks/agg-p05-n08-s03/instruction.md +++ b/tasks/agg-p05-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n08-s03/tests/test.sh b/tasks/agg-p05-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n08-s03/tests/test.sh +++ b/tasks/agg-p05-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n08-s04/instruction.md b/tasks/agg-p05-n08-s04/instruction.md index 2d60bbf6673a6be4cd68c1d77ed23a488a7bf7bf..9ba01c27661d4440f16d9001c644bd0a79960e2c 100644 --- a/tasks/agg-p05-n08-s04/instruction.md +++ b/tasks/agg-p05-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n08-s04/tests/test.sh b/tasks/agg-p05-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n08-s04/tests/test.sh +++ b/tasks/agg-p05-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n08-s05/instruction.md b/tasks/agg-p05-n08-s05/instruction.md index d7293023b756e96b4a6f07b0a65c2cc3406ac4be..bdf5bdd40bc567aa9d5da83763d074be44e853b3 100644 --- a/tasks/agg-p05-n08-s05/instruction.md +++ b/tasks/agg-p05-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n08-s05/tests/test.sh b/tasks/agg-p05-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n08-s05/tests/test.sh +++ b/tasks/agg-p05-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n08-s06/instruction.md b/tasks/agg-p05-n08-s06/instruction.md index eee7a0b5f66fc3863f0f9be834031a101d16805b..e18ab9027af739e0c6a8e15c489ac72b51badfe0 100644 --- a/tasks/agg-p05-n08-s06/instruction.md +++ b/tasks/agg-p05-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n08-s06/tests/test.sh b/tasks/agg-p05-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n08-s06/tests/test.sh +++ b/tasks/agg-p05-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n08-s07/instruction.md b/tasks/agg-p05-n08-s07/instruction.md index 45b59ec949464e2c81423a8f183e17974a93c05c..b0bcae2eeaf25f778f80af13790eba76351df62c 100644 --- a/tasks/agg-p05-n08-s07/instruction.md +++ b/tasks/agg-p05-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n08-s07/tests/test.sh b/tasks/agg-p05-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n08-s07/tests/test.sh +++ b/tasks/agg-p05-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n08-s08/instruction.md b/tasks/agg-p05-n08-s08/instruction.md index 6662e6911ad1105e195cbc6e76b3cc8d9854bef3..d4b85483dd2dae073bb973b1851f38367afa7271 100644 --- a/tasks/agg-p05-n08-s08/instruction.md +++ b/tasks/agg-p05-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n08-s08/tests/test.sh b/tasks/agg-p05-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n08-s08/tests/test.sh +++ b/tasks/agg-p05-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n12-s01/instruction.md b/tasks/agg-p05-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..031c703efd3d4ee9d7e52a3211272bdd8fdb3bc4 --- /dev/null +++ b/tasks/agg-p05-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n12-s01/solution/solve.sh b/tasks/agg-p05-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ac80f263a239d696233f0254f2a627fc7568cf2 --- /dev/null +++ b/tasks/agg-p05-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n12-s01/task.toml b/tasks/agg-p05-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..138d3b614208436997bb21ad62e64964f4f58a80 --- /dev/null +++ b/tasks/agg-p05-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n12-s01/tests/expected.json b/tasks/agg-p05-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c86b97c3f0c771e185a1bc8cec4210f5ea65bb43 --- /dev/null +++ b/tasks/agg-p05-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96] diff --git a/tasks/agg-p05-n12-s01/tests/test.sh b/tasks/agg-p05-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n12-s02/instruction.md b/tasks/agg-p05-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5c22331dc1a92d7ed5e6c9f916d7bff8ffb1e839 --- /dev/null +++ b/tasks/agg-p05-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n12-s02/solution/solve.sh b/tasks/agg-p05-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ac80f263a239d696233f0254f2a627fc7568cf2 --- /dev/null +++ b/tasks/agg-p05-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n12-s02/task.toml b/tasks/agg-p05-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7e4d702be54039c45887090587af68fde6035754 --- /dev/null +++ b/tasks/agg-p05-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n12-s02/tests/expected.json b/tasks/agg-p05-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c86b97c3f0c771e185a1bc8cec4210f5ea65bb43 --- /dev/null +++ b/tasks/agg-p05-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96] diff --git a/tasks/agg-p05-n12-s02/tests/test.sh b/tasks/agg-p05-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n12-s03/instruction.md b/tasks/agg-p05-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..94b2bafb52358803774fef0f96566ce593de1b99 --- /dev/null +++ b/tasks/agg-p05-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n12-s03/solution/solve.sh b/tasks/agg-p05-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ac80f263a239d696233f0254f2a627fc7568cf2 --- /dev/null +++ b/tasks/agg-p05-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n12-s03/task.toml b/tasks/agg-p05-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..779a4a304835af29bc32f137e53be404569df01b --- /dev/null +++ b/tasks/agg-p05-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n12-s03/tests/expected.json b/tasks/agg-p05-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c86b97c3f0c771e185a1bc8cec4210f5ea65bb43 --- /dev/null +++ b/tasks/agg-p05-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96] diff --git a/tasks/agg-p05-n12-s03/tests/test.sh b/tasks/agg-p05-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n12-s04/instruction.md b/tasks/agg-p05-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2d2551d3f0f60676e1ee34e7c12f21100d6a7d1d --- /dev/null +++ b/tasks/agg-p05-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n12-s04/solution/solve.sh b/tasks/agg-p05-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ac80f263a239d696233f0254f2a627fc7568cf2 --- /dev/null +++ b/tasks/agg-p05-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n12-s04/task.toml b/tasks/agg-p05-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b484a0d04e984d3d5371d3b02956611d1ea76508 --- /dev/null +++ b/tasks/agg-p05-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n12-s04/tests/expected.json b/tasks/agg-p05-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c86b97c3f0c771e185a1bc8cec4210f5ea65bb43 --- /dev/null +++ b/tasks/agg-p05-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96] diff --git a/tasks/agg-p05-n12-s04/tests/test.sh b/tasks/agg-p05-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n12-s05/instruction.md b/tasks/agg-p05-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..38af6f0bdb6b176fabb077ede4dd67eef822da02 --- /dev/null +++ b/tasks/agg-p05-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n12-s05/solution/solve.sh b/tasks/agg-p05-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ac80f263a239d696233f0254f2a627fc7568cf2 --- /dev/null +++ b/tasks/agg-p05-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n12-s05/task.toml b/tasks/agg-p05-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..31d2281ff7927c5ca158d82c90db42fb66d97211 --- /dev/null +++ b/tasks/agg-p05-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n12-s05/tests/expected.json b/tasks/agg-p05-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c86b97c3f0c771e185a1bc8cec4210f5ea65bb43 --- /dev/null +++ b/tasks/agg-p05-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96] diff --git a/tasks/agg-p05-n12-s05/tests/test.sh b/tasks/agg-p05-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n12-s06/instruction.md b/tasks/agg-p05-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..297e7df5ad0e1e0ae0182d7fbd8be00d892a2f7e --- /dev/null +++ b/tasks/agg-p05-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n12-s06/solution/solve.sh b/tasks/agg-p05-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ac80f263a239d696233f0254f2a627fc7568cf2 --- /dev/null +++ b/tasks/agg-p05-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n12-s06/task.toml b/tasks/agg-p05-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0eea85d5e122c56ddea80c08cdc6204e8149bb01 --- /dev/null +++ b/tasks/agg-p05-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n12-s06/tests/expected.json b/tasks/agg-p05-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c86b97c3f0c771e185a1bc8cec4210f5ea65bb43 --- /dev/null +++ b/tasks/agg-p05-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96] diff --git a/tasks/agg-p05-n12-s06/tests/test.sh b/tasks/agg-p05-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n12-s07/instruction.md b/tasks/agg-p05-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..89a1678c978d8a496615bec8d74744ae635b59ec --- /dev/null +++ b/tasks/agg-p05-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n12-s07/solution/solve.sh b/tasks/agg-p05-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ac80f263a239d696233f0254f2a627fc7568cf2 --- /dev/null +++ b/tasks/agg-p05-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n12-s07/task.toml b/tasks/agg-p05-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4de3c7b00f6ed14b33a774c266f9db447b5d0dbf --- /dev/null +++ b/tasks/agg-p05-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n12-s07/tests/expected.json b/tasks/agg-p05-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c86b97c3f0c771e185a1bc8cec4210f5ea65bb43 --- /dev/null +++ b/tasks/agg-p05-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96] diff --git a/tasks/agg-p05-n12-s07/tests/test.sh b/tasks/agg-p05-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n12-s08/instruction.md b/tasks/agg-p05-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..50b917cf08b6446450c1a43541739f4d5c2745bd --- /dev/null +++ b/tasks/agg-p05-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n12-s08/solution/solve.sh b/tasks/agg-p05-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ac80f263a239d696233f0254f2a627fc7568cf2 --- /dev/null +++ b/tasks/agg-p05-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n12-s08/task.toml b/tasks/agg-p05-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4c458578d164c365fccf41f3ce89a602f3b3d9d2 --- /dev/null +++ b/tasks/agg-p05-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n12-s08/tests/expected.json b/tasks/agg-p05-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c86b97c3f0c771e185a1bc8cec4210f5ea65bb43 --- /dev/null +++ b/tasks/agg-p05-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96] diff --git a/tasks/agg-p05-n12-s08/tests/test.sh b/tasks/agg-p05-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n12-s09/instruction.md b/tasks/agg-p05-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bc6ecc07cf5acdcd085bd56b2102f26cc68f534e --- /dev/null +++ b/tasks/agg-p05-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n12-s09/solution/solve.sh b/tasks/agg-p05-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ac80f263a239d696233f0254f2a627fc7568cf2 --- /dev/null +++ b/tasks/agg-p05-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n12-s09/task.toml b/tasks/agg-p05-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..40d50052d017281ce4987a72881fce60f0503938 --- /dev/null +++ b/tasks/agg-p05-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n12-s09/tests/expected.json b/tasks/agg-p05-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c86b97c3f0c771e185a1bc8cec4210f5ea65bb43 --- /dev/null +++ b/tasks/agg-p05-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96] diff --git a/tasks/agg-p05-n12-s09/tests/test.sh b/tasks/agg-p05-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n12-s10/instruction.md b/tasks/agg-p05-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d78566c7957cbe8132af56f4888ef6e81649dcb3 --- /dev/null +++ b/tasks/agg-p05-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n12-s10/solution/solve.sh b/tasks/agg-p05-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ac80f263a239d696233f0254f2a627fc7568cf2 --- /dev/null +++ b/tasks/agg-p05-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n12-s10/task.toml b/tasks/agg-p05-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8018c3db15ea16f0f95118c8af27c5236e4a8b97 --- /dev/null +++ b/tasks/agg-p05-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n12-s10/tests/expected.json b/tasks/agg-p05-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c86b97c3f0c771e185a1bc8cec4210f5ea65bb43 --- /dev/null +++ b/tasks/agg-p05-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96] diff --git a/tasks/agg-p05-n12-s10/tests/test.sh b/tasks/agg-p05-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n12-s11/instruction.md b/tasks/agg-p05-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..894c08d452dd150a471307a3b982c78b62f7152f --- /dev/null +++ b/tasks/agg-p05-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n12-s11/solution/solve.sh b/tasks/agg-p05-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ac80f263a239d696233f0254f2a627fc7568cf2 --- /dev/null +++ b/tasks/agg-p05-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n12-s11/task.toml b/tasks/agg-p05-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bb111b909ada9b020ec638900b97cdf01de91d62 --- /dev/null +++ b/tasks/agg-p05-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n12-s11/tests/expected.json b/tasks/agg-p05-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c86b97c3f0c771e185a1bc8cec4210f5ea65bb43 --- /dev/null +++ b/tasks/agg-p05-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96] diff --git a/tasks/agg-p05-n12-s11/tests/test.sh b/tasks/agg-p05-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n12-s12/instruction.md b/tasks/agg-p05-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6e844f7a3e8d345b3d28255a1eef90feb406b747 --- /dev/null +++ b/tasks/agg-p05-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n12-s12/solution/solve.sh b/tasks/agg-p05-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ac80f263a239d696233f0254f2a627fc7568cf2 --- /dev/null +++ b/tasks/agg-p05-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96]' > "$answer" diff --git a/tasks/agg-p05-n12-s12/task.toml b/tasks/agg-p05-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bea35ec8e09377aa7916011fa6ee4555335c4e1c --- /dev/null +++ b/tasks/agg-p05-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p05-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 5 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p05-n12-s12/tests/expected.json b/tasks/agg-p05-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c86b97c3f0c771e185a1bc8cec4210f5ea65bb43 --- /dev/null +++ b/tasks/agg-p05-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[18, 25, 40, 43, 57, 66, 68, 79, 84, 87, 93, 96] diff --git a/tasks/agg-p05-n12-s12/tests/test.sh b/tasks/agg-p05-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p05-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p05-n16-s01/instruction.md b/tasks/agg-p05-n16-s01/instruction.md index 3c1a8c1b0c33b8354227b277a5b1885c3067b4d2..6a9948c4088c17e7b78a078e0010c060500c2e8e 100644 --- a/tasks/agg-p05-n16-s01/instruction.md +++ b/tasks/agg-p05-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s01/tests/test.sh b/tasks/agg-p05-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s01/tests/test.sh +++ b/tasks/agg-p05-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s02/instruction.md b/tasks/agg-p05-n16-s02/instruction.md index 5a931caf2f59950e949680657e57e512d16ee533..e73e804c423ed11a4e1c56759956f246bcd22e10 100644 --- a/tasks/agg-p05-n16-s02/instruction.md +++ b/tasks/agg-p05-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s02/tests/test.sh b/tasks/agg-p05-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s02/tests/test.sh +++ b/tasks/agg-p05-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s03/instruction.md b/tasks/agg-p05-n16-s03/instruction.md index 9e673d50df3d0049f8ebbc5f08e69f16f929b38f..f17a373aff362de5ccbc3d2752a0dc99bf30605b 100644 --- a/tasks/agg-p05-n16-s03/instruction.md +++ b/tasks/agg-p05-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s03/tests/test.sh b/tasks/agg-p05-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s03/tests/test.sh +++ b/tasks/agg-p05-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s04/instruction.md b/tasks/agg-p05-n16-s04/instruction.md index 842ab62762da159702eecd05bee6231e50b04d8f..3585f20798dad91576432b94fc5446156ebc4cbd 100644 --- a/tasks/agg-p05-n16-s04/instruction.md +++ b/tasks/agg-p05-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s04/tests/test.sh b/tasks/agg-p05-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s04/tests/test.sh +++ b/tasks/agg-p05-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s05/instruction.md b/tasks/agg-p05-n16-s05/instruction.md index ebe30196b058cfe81ab8a53dd5461649bcf91202..7078e28d54452ae1cab8849d4648225bf8c92be9 100644 --- a/tasks/agg-p05-n16-s05/instruction.md +++ b/tasks/agg-p05-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s05/tests/test.sh b/tasks/agg-p05-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s05/tests/test.sh +++ b/tasks/agg-p05-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s06/instruction.md b/tasks/agg-p05-n16-s06/instruction.md index 04c3f6729149d2802728807768786a453bb32941..66fed180f5ece962b8f35828f82d008e1814560f 100644 --- a/tasks/agg-p05-n16-s06/instruction.md +++ b/tasks/agg-p05-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s06/tests/test.sh b/tasks/agg-p05-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s06/tests/test.sh +++ b/tasks/agg-p05-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s07/instruction.md b/tasks/agg-p05-n16-s07/instruction.md index a7f0266a5e6733a93cf24a409665e6e92f793dba..d4d40f859809c8e8513c129e910f96795729f446 100644 --- a/tasks/agg-p05-n16-s07/instruction.md +++ b/tasks/agg-p05-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s07/tests/test.sh b/tasks/agg-p05-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s07/tests/test.sh +++ b/tasks/agg-p05-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s08/instruction.md b/tasks/agg-p05-n16-s08/instruction.md index 7d5ca093d11da3b866f85566039dbc2ac3bc8c84..7fe87dfffe4ad85e98cdbb07e05a77bf8a912afc 100644 --- a/tasks/agg-p05-n16-s08/instruction.md +++ b/tasks/agg-p05-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s08/tests/test.sh b/tasks/agg-p05-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s08/tests/test.sh +++ b/tasks/agg-p05-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s09/instruction.md b/tasks/agg-p05-n16-s09/instruction.md index 57c62f85ec1ef4f9ca9aa899d016621c4b04432a..e1bd267ed9ac9c4fbf94870756f771be1265779a 100644 --- a/tasks/agg-p05-n16-s09/instruction.md +++ b/tasks/agg-p05-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s09/tests/test.sh b/tasks/agg-p05-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s09/tests/test.sh +++ b/tasks/agg-p05-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s10/instruction.md b/tasks/agg-p05-n16-s10/instruction.md index f9807e3dca090e22409202efda192d4a7b9f5ac5..f9190cd6f2d679efa59828aa0ffdff708c0d41ce 100644 --- a/tasks/agg-p05-n16-s10/instruction.md +++ b/tasks/agg-p05-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s10/tests/test.sh b/tasks/agg-p05-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s10/tests/test.sh +++ b/tasks/agg-p05-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s11/instruction.md b/tasks/agg-p05-n16-s11/instruction.md index c0f9d178a1c3057c8c4b57e9c5eca4e4c625b138..efa987bc861271d3fcd4cc6f1530e4d2ecbb6990 100644 --- a/tasks/agg-p05-n16-s11/instruction.md +++ b/tasks/agg-p05-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s11/tests/test.sh b/tasks/agg-p05-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s11/tests/test.sh +++ b/tasks/agg-p05-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s12/instruction.md b/tasks/agg-p05-n16-s12/instruction.md index bec568d59f85e2e30c1eb04f810b7ec136113a04..d047a7120223676abdd7f02b0240a56c724e3fff 100644 --- a/tasks/agg-p05-n16-s12/instruction.md +++ b/tasks/agg-p05-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s12/tests/test.sh b/tasks/agg-p05-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s12/tests/test.sh +++ b/tasks/agg-p05-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s13/instruction.md b/tasks/agg-p05-n16-s13/instruction.md index d92b3c67aa869a2b7ccb0b74ca78af94faae0b02..671a8ab2cae28823934c021dcf645fc4038d0570 100644 --- a/tasks/agg-p05-n16-s13/instruction.md +++ b/tasks/agg-p05-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s13/tests/test.sh b/tasks/agg-p05-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s13/tests/test.sh +++ b/tasks/agg-p05-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s14/instruction.md b/tasks/agg-p05-n16-s14/instruction.md index 722dd06eb5b0a1781e34a4a84c87448b77da2a59..5e39eb31f3bfe02211382c86f30186b5bbd8d4ba 100644 --- a/tasks/agg-p05-n16-s14/instruction.md +++ b/tasks/agg-p05-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s14/tests/test.sh b/tasks/agg-p05-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s14/tests/test.sh +++ b/tasks/agg-p05-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s15/instruction.md b/tasks/agg-p05-n16-s15/instruction.md index 93b42da3c5ae14f9371e8643b81073fb0536e08a..366c2719a35a34f7a33d98415916d2080eb2b7e2 100644 --- a/tasks/agg-p05-n16-s15/instruction.md +++ b/tasks/agg-p05-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s15/tests/test.sh b/tasks/agg-p05-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s15/tests/test.sh +++ b/tasks/agg-p05-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p05-n16-s16/instruction.md b/tasks/agg-p05-n16-s16/instruction.md index 8719f945164b6c7adba0eec9b9728be32d6bfe5e..10a630b21435ec8e620ae5e83c5dc41b678c1031 100644 --- a/tasks/agg-p05-n16-s16/instruction.md +++ b/tasks/agg-p05-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p05-n16-s16/tests/test.sh b/tasks/agg-p05-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p05-n16-s16/tests/test.sh +++ b/tasks/agg-p05-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n01-s01/instruction.md b/tasks/agg-p06-n01-s01/instruction.md index 475c65ec95392cf749d137cd3dcf0ef8597e7720..605a83c6d1e504fef8f2aefbdd230789c38e5abd 100644 --- a/tasks/agg-p06-n01-s01/instruction.md +++ b/tasks/agg-p06-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is seventy-six. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p06-n01-s01/tests/test.sh b/tasks/agg-p06-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n01-s01/tests/test.sh +++ b/tasks/agg-p06-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n02-s01/instruction.md b/tasks/agg-p06-n02-s01/instruction.md index c4555e9f351f3bb16094957a1ab3eca157d21342..c2d54175f6bc77f387242e7123026a7dadd68710 100644 --- a/tasks/agg-p06-n02-s01/instruction.md +++ b/tasks/agg-p06-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n02-s01/tests/test.sh b/tasks/agg-p06-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n02-s01/tests/test.sh +++ b/tasks/agg-p06-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n02-s02/instruction.md b/tasks/agg-p06-n02-s02/instruction.md index c0bd303417274bf1a0c037286116fba257c99c87..0a79a1ed43ac78a99007d72b4caa104823ac0512 100644 --- a/tasks/agg-p06-n02-s02/instruction.md +++ b/tasks/agg-p06-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n02-s02/tests/test.sh b/tasks/agg-p06-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n02-s02/tests/test.sh +++ b/tasks/agg-p06-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n04-s01/instruction.md b/tasks/agg-p06-n04-s01/instruction.md index c21c7a1db5037ab3c606d1dc4e0e4e760f674b32..57ec21a69968bcb0cbac2c948b4fd8bb722e28a6 100644 --- a/tasks/agg-p06-n04-s01/instruction.md +++ b/tasks/agg-p06-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n04-s01/tests/test.sh b/tasks/agg-p06-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n04-s01/tests/test.sh +++ b/tasks/agg-p06-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n04-s02/instruction.md b/tasks/agg-p06-n04-s02/instruction.md index 68b7508bd8f70bb90517cd8b23e9d1db9ea72eca..d96933241d61e955fa8544e894ba163c34a7af6e 100644 --- a/tasks/agg-p06-n04-s02/instruction.md +++ b/tasks/agg-p06-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n04-s02/tests/test.sh b/tasks/agg-p06-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n04-s02/tests/test.sh +++ b/tasks/agg-p06-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n04-s03/instruction.md b/tasks/agg-p06-n04-s03/instruction.md index 67d6711b93a0ab5ee2589dc54a7b1a7249bacab9..ea53f20eb813f80c87a0afec5dad8206d82bfbac 100644 --- a/tasks/agg-p06-n04-s03/instruction.md +++ b/tasks/agg-p06-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n04-s03/tests/test.sh b/tasks/agg-p06-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n04-s03/tests/test.sh +++ b/tasks/agg-p06-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n04-s04/instruction.md b/tasks/agg-p06-n04-s04/instruction.md index d0dfdb8971478a2127834dce630001bce8e7328c..8e32c04cab62402aa847cdee44a38b22a1633292 100644 --- a/tasks/agg-p06-n04-s04/instruction.md +++ b/tasks/agg-p06-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n04-s04/tests/test.sh b/tasks/agg-p06-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n04-s04/tests/test.sh +++ b/tasks/agg-p06-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n06-s01/instruction.md b/tasks/agg-p06-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..347b7a6ef4f5df1aa1e5059b01a78407a91adfde --- /dev/null +++ b/tasks/agg-p06-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n06-s01/solution/solve.sh b/tasks/agg-p06-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e77a2bad46949cc8b8578eb2c33b8d160e3d612a --- /dev/null +++ b/tasks/agg-p06-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 11, 23, 54, 76, 85]' > "$answer" diff --git a/tasks/agg-p06-n06-s01/task.toml b/tasks/agg-p06-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..218cc47197429f770850675a8fb62d3f90f77fb0 --- /dev/null +++ b/tasks/agg-p06-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n06-s01/tests/expected.json b/tasks/agg-p06-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3c0c06db3db1802b15847a6c1e8d57dc978fd255 --- /dev/null +++ b/tasks/agg-p06-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[8, 11, 23, 54, 76, 85] diff --git a/tasks/agg-p06-n06-s01/tests/test.sh b/tasks/agg-p06-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n06-s02/instruction.md b/tasks/agg-p06-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..db46a85781c5f4b05255f5b663546479ae052559 --- /dev/null +++ b/tasks/agg-p06-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n06-s02/solution/solve.sh b/tasks/agg-p06-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e77a2bad46949cc8b8578eb2c33b8d160e3d612a --- /dev/null +++ b/tasks/agg-p06-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 11, 23, 54, 76, 85]' > "$answer" diff --git a/tasks/agg-p06-n06-s02/task.toml b/tasks/agg-p06-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f33c62b5f20d91449a74e3293620abf84397169f --- /dev/null +++ b/tasks/agg-p06-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n06-s02/tests/expected.json b/tasks/agg-p06-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3c0c06db3db1802b15847a6c1e8d57dc978fd255 --- /dev/null +++ b/tasks/agg-p06-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[8, 11, 23, 54, 76, 85] diff --git a/tasks/agg-p06-n06-s02/tests/test.sh b/tasks/agg-p06-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n06-s03/instruction.md b/tasks/agg-p06-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bd883ff730eeb57d3f44a55d1e7a21aa75bbff7d --- /dev/null +++ b/tasks/agg-p06-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n06-s03/solution/solve.sh b/tasks/agg-p06-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e77a2bad46949cc8b8578eb2c33b8d160e3d612a --- /dev/null +++ b/tasks/agg-p06-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 11, 23, 54, 76, 85]' > "$answer" diff --git a/tasks/agg-p06-n06-s03/task.toml b/tasks/agg-p06-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..31bf2917ba610486d3a59dbe159e525234bdd875 --- /dev/null +++ b/tasks/agg-p06-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n06-s03/tests/expected.json b/tasks/agg-p06-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3c0c06db3db1802b15847a6c1e8d57dc978fd255 --- /dev/null +++ b/tasks/agg-p06-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[8, 11, 23, 54, 76, 85] diff --git a/tasks/agg-p06-n06-s03/tests/test.sh b/tasks/agg-p06-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n06-s04/instruction.md b/tasks/agg-p06-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..31899d656ba6c4fe261671ef0578d92635262d78 --- /dev/null +++ b/tasks/agg-p06-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n06-s04/solution/solve.sh b/tasks/agg-p06-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e77a2bad46949cc8b8578eb2c33b8d160e3d612a --- /dev/null +++ b/tasks/agg-p06-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 11, 23, 54, 76, 85]' > "$answer" diff --git a/tasks/agg-p06-n06-s04/task.toml b/tasks/agg-p06-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..574bae27a4ad5c103da3c8894a88e28a4b0269b3 --- /dev/null +++ b/tasks/agg-p06-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n06-s04/tests/expected.json b/tasks/agg-p06-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3c0c06db3db1802b15847a6c1e8d57dc978fd255 --- /dev/null +++ b/tasks/agg-p06-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[8, 11, 23, 54, 76, 85] diff --git a/tasks/agg-p06-n06-s04/tests/test.sh b/tasks/agg-p06-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n06-s05/instruction.md b/tasks/agg-p06-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..3e1f1c0545efd4a8eb8573cd18224dfe2682ea3c --- /dev/null +++ b/tasks/agg-p06-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eleven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n06-s05/solution/solve.sh b/tasks/agg-p06-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e77a2bad46949cc8b8578eb2c33b8d160e3d612a --- /dev/null +++ b/tasks/agg-p06-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 11, 23, 54, 76, 85]' > "$answer" diff --git a/tasks/agg-p06-n06-s05/task.toml b/tasks/agg-p06-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e97e6336012c339fadd3cc183886eed1dceda610 --- /dev/null +++ b/tasks/agg-p06-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n06-s05/tests/expected.json b/tasks/agg-p06-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3c0c06db3db1802b15847a6c1e8d57dc978fd255 --- /dev/null +++ b/tasks/agg-p06-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[8, 11, 23, 54, 76, 85] diff --git a/tasks/agg-p06-n06-s05/tests/test.sh b/tasks/agg-p06-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n06-s06/instruction.md b/tasks/agg-p06-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c51332c60dce3bcfa01bbc569eaefb90ebc3e043 --- /dev/null +++ b/tasks/agg-p06-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n06-s06/solution/solve.sh b/tasks/agg-p06-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e77a2bad46949cc8b8578eb2c33b8d160e3d612a --- /dev/null +++ b/tasks/agg-p06-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 11, 23, 54, 76, 85]' > "$answer" diff --git a/tasks/agg-p06-n06-s06/task.toml b/tasks/agg-p06-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f9f326078d9536bb8e0258af34e47f0fc91c55be --- /dev/null +++ b/tasks/agg-p06-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n06-s06/tests/expected.json b/tasks/agg-p06-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3c0c06db3db1802b15847a6c1e8d57dc978fd255 --- /dev/null +++ b/tasks/agg-p06-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[8, 11, 23, 54, 76, 85] diff --git a/tasks/agg-p06-n06-s06/tests/test.sh b/tasks/agg-p06-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n08-s01/instruction.md b/tasks/agg-p06-n08-s01/instruction.md index 7ece2400f884b5e1f3fa3ff4655932d91db83df1..44aaaed3ac27797250a45c0b0cdb58d78c0f16a8 100644 --- a/tasks/agg-p06-n08-s01/instruction.md +++ b/tasks/agg-p06-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n08-s01/tests/test.sh b/tasks/agg-p06-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n08-s01/tests/test.sh +++ b/tasks/agg-p06-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n08-s02/instruction.md b/tasks/agg-p06-n08-s02/instruction.md index 5b14deaa7622dc83330db4194d812edbd5c8daec..93afa9364b0adb56c55e6be58f7c5120524812fd 100644 --- a/tasks/agg-p06-n08-s02/instruction.md +++ b/tasks/agg-p06-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n08-s02/tests/test.sh b/tasks/agg-p06-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n08-s02/tests/test.sh +++ b/tasks/agg-p06-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n08-s03/instruction.md b/tasks/agg-p06-n08-s03/instruction.md index fb9a5a5e841fd2441b11cbee99000a82617ba549..c4d59599040c183c644da71859bea8cee1fe06cf 100644 --- a/tasks/agg-p06-n08-s03/instruction.md +++ b/tasks/agg-p06-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n08-s03/tests/test.sh b/tasks/agg-p06-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n08-s03/tests/test.sh +++ b/tasks/agg-p06-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n08-s04/instruction.md b/tasks/agg-p06-n08-s04/instruction.md index 69ba917f6c6eae1a89454fec3af62dc26ea478c0..9af8abd7186a7fe77f443e5f122b33c758dcbca6 100644 --- a/tasks/agg-p06-n08-s04/instruction.md +++ b/tasks/agg-p06-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n08-s04/tests/test.sh b/tasks/agg-p06-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n08-s04/tests/test.sh +++ b/tasks/agg-p06-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n08-s05/instruction.md b/tasks/agg-p06-n08-s05/instruction.md index f175a93401463f943739d764505f2ddcec86791a..85223bfc1cb94e49085ab22c6f699320f0057489 100644 --- a/tasks/agg-p06-n08-s05/instruction.md +++ b/tasks/agg-p06-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n08-s05/tests/test.sh b/tasks/agg-p06-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n08-s05/tests/test.sh +++ b/tasks/agg-p06-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n08-s06/instruction.md b/tasks/agg-p06-n08-s06/instruction.md index ee602d2ed51f86295f1f477b0dc17b27fbe00ab3..3c11876bf7d7979bedc0677067808c4383330064 100644 --- a/tasks/agg-p06-n08-s06/instruction.md +++ b/tasks/agg-p06-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n08-s06/tests/test.sh b/tasks/agg-p06-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n08-s06/tests/test.sh +++ b/tasks/agg-p06-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n08-s07/instruction.md b/tasks/agg-p06-n08-s07/instruction.md index 0ee10142e61d08a5571772c533b83202fd01c84e..1d56cadf04393cae3e1d171ef0b958fbd4a2d7f4 100644 --- a/tasks/agg-p06-n08-s07/instruction.md +++ b/tasks/agg-p06-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n08-s07/tests/test.sh b/tasks/agg-p06-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n08-s07/tests/test.sh +++ b/tasks/agg-p06-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n08-s08/instruction.md b/tasks/agg-p06-n08-s08/instruction.md index 3db91c415e1fee104109b51426264d7f82e4a8ac..37cf5609ab85a6c14a3ed2778f40e1a369d56e75 100644 --- a/tasks/agg-p06-n08-s08/instruction.md +++ b/tasks/agg-p06-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n08-s08/tests/test.sh b/tasks/agg-p06-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n08-s08/tests/test.sh +++ b/tasks/agg-p06-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n12-s01/instruction.md b/tasks/agg-p06-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..55211891d2eae86ad815f2101b3fba33c6a19886 --- /dev/null +++ b/tasks/agg-p06-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n12-s01/solution/solve.sh b/tasks/agg-p06-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d1e84a3f063b846709d0ba21ebead9c497147b54 --- /dev/null +++ b/tasks/agg-p06-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85]' > "$answer" diff --git a/tasks/agg-p06-n12-s01/task.toml b/tasks/agg-p06-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7403b35fe2e685a436e7ac46b2a37616ec801e1b --- /dev/null +++ b/tasks/agg-p06-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n12-s01/tests/expected.json b/tasks/agg-p06-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d4fb737cd353ec9c4abc6a0f5cbb763cc0ffb2 --- /dev/null +++ b/tasks/agg-p06-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85] diff --git a/tasks/agg-p06-n12-s01/tests/test.sh b/tasks/agg-p06-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n12-s02/instruction.md b/tasks/agg-p06-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1ec3d2a16079c4d9737f2784ae217eea77d88533 --- /dev/null +++ b/tasks/agg-p06-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n12-s02/solution/solve.sh b/tasks/agg-p06-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d1e84a3f063b846709d0ba21ebead9c497147b54 --- /dev/null +++ b/tasks/agg-p06-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85]' > "$answer" diff --git a/tasks/agg-p06-n12-s02/task.toml b/tasks/agg-p06-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6c6b256bd0720e8a56adb78db6c984daf43d6278 --- /dev/null +++ b/tasks/agg-p06-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n12-s02/tests/expected.json b/tasks/agg-p06-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d4fb737cd353ec9c4abc6a0f5cbb763cc0ffb2 --- /dev/null +++ b/tasks/agg-p06-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85] diff --git a/tasks/agg-p06-n12-s02/tests/test.sh b/tasks/agg-p06-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n12-s03/instruction.md b/tasks/agg-p06-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7201ad16b41f6e2d149e2c45df4bcd774a258af1 --- /dev/null +++ b/tasks/agg-p06-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n12-s03/solution/solve.sh b/tasks/agg-p06-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d1e84a3f063b846709d0ba21ebead9c497147b54 --- /dev/null +++ b/tasks/agg-p06-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85]' > "$answer" diff --git a/tasks/agg-p06-n12-s03/task.toml b/tasks/agg-p06-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a65b7d96ec6fd941e6ae93af59d874133afeed54 --- /dev/null +++ b/tasks/agg-p06-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n12-s03/tests/expected.json b/tasks/agg-p06-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d4fb737cd353ec9c4abc6a0f5cbb763cc0ffb2 --- /dev/null +++ b/tasks/agg-p06-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85] diff --git a/tasks/agg-p06-n12-s03/tests/test.sh b/tasks/agg-p06-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n12-s04/instruction.md b/tasks/agg-p06-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..92a22d6cf9a7e49a077d762bec35bc485b2caf87 --- /dev/null +++ b/tasks/agg-p06-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n12-s04/solution/solve.sh b/tasks/agg-p06-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d1e84a3f063b846709d0ba21ebead9c497147b54 --- /dev/null +++ b/tasks/agg-p06-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85]' > "$answer" diff --git a/tasks/agg-p06-n12-s04/task.toml b/tasks/agg-p06-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e68bd33b98b7f9dd4ef26053eb7d293e29f9a99d --- /dev/null +++ b/tasks/agg-p06-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n12-s04/tests/expected.json b/tasks/agg-p06-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d4fb737cd353ec9c4abc6a0f5cbb763cc0ffb2 --- /dev/null +++ b/tasks/agg-p06-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85] diff --git a/tasks/agg-p06-n12-s04/tests/test.sh b/tasks/agg-p06-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n12-s05/instruction.md b/tasks/agg-p06-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1e4de5bf2858b7b47780fdbcb584221024d8f518 --- /dev/null +++ b/tasks/agg-p06-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eleven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n12-s05/solution/solve.sh b/tasks/agg-p06-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d1e84a3f063b846709d0ba21ebead9c497147b54 --- /dev/null +++ b/tasks/agg-p06-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85]' > "$answer" diff --git a/tasks/agg-p06-n12-s05/task.toml b/tasks/agg-p06-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e1acb1a2c88f2cb3366687acc99ff8759f561b1b --- /dev/null +++ b/tasks/agg-p06-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n12-s05/tests/expected.json b/tasks/agg-p06-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d4fb737cd353ec9c4abc6a0f5cbb763cc0ffb2 --- /dev/null +++ b/tasks/agg-p06-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85] diff --git a/tasks/agg-p06-n12-s05/tests/test.sh b/tasks/agg-p06-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n12-s06/instruction.md b/tasks/agg-p06-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5937949c7bcb7a88691fdbc04d0f8ce8273fab17 --- /dev/null +++ b/tasks/agg-p06-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n12-s06/solution/solve.sh b/tasks/agg-p06-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d1e84a3f063b846709d0ba21ebead9c497147b54 --- /dev/null +++ b/tasks/agg-p06-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85]' > "$answer" diff --git a/tasks/agg-p06-n12-s06/task.toml b/tasks/agg-p06-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9275028a89f5bc6e81dd837d6e99ebee950203bb --- /dev/null +++ b/tasks/agg-p06-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n12-s06/tests/expected.json b/tasks/agg-p06-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d4fb737cd353ec9c4abc6a0f5cbb763cc0ffb2 --- /dev/null +++ b/tasks/agg-p06-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85] diff --git a/tasks/agg-p06-n12-s06/tests/test.sh b/tasks/agg-p06-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n12-s07/instruction.md b/tasks/agg-p06-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..054dc42296a82036d581d99f90bd071c5bc61a63 --- /dev/null +++ b/tasks/agg-p06-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n12-s07/solution/solve.sh b/tasks/agg-p06-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d1e84a3f063b846709d0ba21ebead9c497147b54 --- /dev/null +++ b/tasks/agg-p06-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85]' > "$answer" diff --git a/tasks/agg-p06-n12-s07/task.toml b/tasks/agg-p06-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..47bd8fb2b1f4b4b53d372bc8b7e0911a87d69d43 --- /dev/null +++ b/tasks/agg-p06-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n12-s07/tests/expected.json b/tasks/agg-p06-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d4fb737cd353ec9c4abc6a0f5cbb763cc0ffb2 --- /dev/null +++ b/tasks/agg-p06-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85] diff --git a/tasks/agg-p06-n12-s07/tests/test.sh b/tasks/agg-p06-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n12-s08/instruction.md b/tasks/agg-p06-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..118bd725edb89efa2a1d06b9a496624d12c54355 --- /dev/null +++ b/tasks/agg-p06-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n12-s08/solution/solve.sh b/tasks/agg-p06-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d1e84a3f063b846709d0ba21ebead9c497147b54 --- /dev/null +++ b/tasks/agg-p06-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85]' > "$answer" diff --git a/tasks/agg-p06-n12-s08/task.toml b/tasks/agg-p06-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2ec4167ac5437e89ca9c2052cb32dd6f9cfd38a2 --- /dev/null +++ b/tasks/agg-p06-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n12-s08/tests/expected.json b/tasks/agg-p06-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d4fb737cd353ec9c4abc6a0f5cbb763cc0ffb2 --- /dev/null +++ b/tasks/agg-p06-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85] diff --git a/tasks/agg-p06-n12-s08/tests/test.sh b/tasks/agg-p06-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n12-s09/instruction.md b/tasks/agg-p06-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..519523fa549585a9595ce676c83c5ebd96f5e138 --- /dev/null +++ b/tasks/agg-p06-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n12-s09/solution/solve.sh b/tasks/agg-p06-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d1e84a3f063b846709d0ba21ebead9c497147b54 --- /dev/null +++ b/tasks/agg-p06-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85]' > "$answer" diff --git a/tasks/agg-p06-n12-s09/task.toml b/tasks/agg-p06-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d10bf7a4c62f25d04c4ba555dc0ea5b1dbbc1ad5 --- /dev/null +++ b/tasks/agg-p06-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n12-s09/tests/expected.json b/tasks/agg-p06-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d4fb737cd353ec9c4abc6a0f5cbb763cc0ffb2 --- /dev/null +++ b/tasks/agg-p06-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85] diff --git a/tasks/agg-p06-n12-s09/tests/test.sh b/tasks/agg-p06-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n12-s10/instruction.md b/tasks/agg-p06-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9b0eae8063e1419234bd5a4b5a1fded790f6da23 --- /dev/null +++ b/tasks/agg-p06-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n12-s10/solution/solve.sh b/tasks/agg-p06-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d1e84a3f063b846709d0ba21ebead9c497147b54 --- /dev/null +++ b/tasks/agg-p06-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85]' > "$answer" diff --git a/tasks/agg-p06-n12-s10/task.toml b/tasks/agg-p06-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..53c608b01ee724bcbb669800bacd442a352ebf3d --- /dev/null +++ b/tasks/agg-p06-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n12-s10/tests/expected.json b/tasks/agg-p06-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d4fb737cd353ec9c4abc6a0f5cbb763cc0ffb2 --- /dev/null +++ b/tasks/agg-p06-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85] diff --git a/tasks/agg-p06-n12-s10/tests/test.sh b/tasks/agg-p06-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n12-s11/instruction.md b/tasks/agg-p06-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bc6ecc07cf5acdcd085bd56b2102f26cc68f534e --- /dev/null +++ b/tasks/agg-p06-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n12-s11/solution/solve.sh b/tasks/agg-p06-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d1e84a3f063b846709d0ba21ebead9c497147b54 --- /dev/null +++ b/tasks/agg-p06-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85]' > "$answer" diff --git a/tasks/agg-p06-n12-s11/task.toml b/tasks/agg-p06-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f30b4c48a344dee6c2fc0ee830f35d5e8981a2f8 --- /dev/null +++ b/tasks/agg-p06-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n12-s11/tests/expected.json b/tasks/agg-p06-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d4fb737cd353ec9c4abc6a0f5cbb763cc0ffb2 --- /dev/null +++ b/tasks/agg-p06-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85] diff --git a/tasks/agg-p06-n12-s11/tests/test.sh b/tasks/agg-p06-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n12-s12/instruction.md b/tasks/agg-p06-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2d59f1157c1824f7f2e06071771dcd5b3a427585 --- /dev/null +++ b/tasks/agg-p06-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n12-s12/solution/solve.sh b/tasks/agg-p06-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d1e84a3f063b846709d0ba21ebead9c497147b54 --- /dev/null +++ b/tasks/agg-p06-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85]' > "$answer" diff --git a/tasks/agg-p06-n12-s12/task.toml b/tasks/agg-p06-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..23bc6d5ca4906779e4a7b6fb2c57dd85f36e670d --- /dev/null +++ b/tasks/agg-p06-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p06-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 6 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p06-n12-s12/tests/expected.json b/tasks/agg-p06-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c4d4fb737cd353ec9c4abc6a0f5cbb763cc0ffb2 --- /dev/null +++ b/tasks/agg-p06-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 7, 8, 11, 18, 23, 35, 54, 76, 78, 85] diff --git a/tasks/agg-p06-n12-s12/tests/test.sh b/tasks/agg-p06-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p06-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p06-n16-s01/instruction.md b/tasks/agg-p06-n16-s01/instruction.md index 1fc02ff38c01961e6ef2d04b50e560edacdcca90..1d5113c5dd5abf3bbd4601fe16ab16e11d5a8b7c 100644 --- a/tasks/agg-p06-n16-s01/instruction.md +++ b/tasks/agg-p06-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s01/tests/test.sh b/tasks/agg-p06-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s01/tests/test.sh +++ b/tasks/agg-p06-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s02/instruction.md b/tasks/agg-p06-n16-s02/instruction.md index 07133633c82ade16a43a26c7ec6cacc19d41b3bd..01eccecf7626f9336ce7f443b7b16b6f87314d4c 100644 --- a/tasks/agg-p06-n16-s02/instruction.md +++ b/tasks/agg-p06-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s02/tests/test.sh b/tasks/agg-p06-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s02/tests/test.sh +++ b/tasks/agg-p06-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s03/instruction.md b/tasks/agg-p06-n16-s03/instruction.md index 99a7f97eb2774bf91fcf02fc9e18c71f2c746d9d..b0c86232070beace6f6b66df51114731c8869870 100644 --- a/tasks/agg-p06-n16-s03/instruction.md +++ b/tasks/agg-p06-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s03/tests/test.sh b/tasks/agg-p06-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s03/tests/test.sh +++ b/tasks/agg-p06-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s04/instruction.md b/tasks/agg-p06-n16-s04/instruction.md index a74f85b07c6b9158e3042c827fbada79d595e8f5..364d02befda9eef167acd079029967edd1989d2b 100644 --- a/tasks/agg-p06-n16-s04/instruction.md +++ b/tasks/agg-p06-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s04/tests/test.sh b/tasks/agg-p06-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s04/tests/test.sh +++ b/tasks/agg-p06-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s05/instruction.md b/tasks/agg-p06-n16-s05/instruction.md index 0f12c719492f216b9a3df72f8d724b2259725c6d..1d57dd2778af84c781626fc62484b7570c395997 100644 --- a/tasks/agg-p06-n16-s05/instruction.md +++ b/tasks/agg-p06-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s05/tests/test.sh b/tasks/agg-p06-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s05/tests/test.sh +++ b/tasks/agg-p06-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s06/instruction.md b/tasks/agg-p06-n16-s06/instruction.md index a1e1d14ddbf968be7e060dd9f860572ccdbd16d1..99dfe0570e82593ebf42356aba3edfd1fd62d038 100644 --- a/tasks/agg-p06-n16-s06/instruction.md +++ b/tasks/agg-p06-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s06/tests/test.sh b/tasks/agg-p06-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s06/tests/test.sh +++ b/tasks/agg-p06-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s07/instruction.md b/tasks/agg-p06-n16-s07/instruction.md index bd54876511397bdb80a3c3299556503e1fd15da5..ffc3934425adafa34ada41ff5621db5d0f97a3bb 100644 --- a/tasks/agg-p06-n16-s07/instruction.md +++ b/tasks/agg-p06-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s07/tests/test.sh b/tasks/agg-p06-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s07/tests/test.sh +++ b/tasks/agg-p06-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s08/instruction.md b/tasks/agg-p06-n16-s08/instruction.md index 1fe2576f1a20a278b177c066abc20e44af6a4729..5a9e9eac10d0ea0b9cedb5eefc9f2ace5395d6a9 100644 --- a/tasks/agg-p06-n16-s08/instruction.md +++ b/tasks/agg-p06-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s08/tests/test.sh b/tasks/agg-p06-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s08/tests/test.sh +++ b/tasks/agg-p06-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s09/instruction.md b/tasks/agg-p06-n16-s09/instruction.md index 9137a4ab46a628c60be0b75972f0a9947e2c3883..4c327201eb92082d75247de85279b2149f069a49 100644 --- a/tasks/agg-p06-n16-s09/instruction.md +++ b/tasks/agg-p06-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s09/tests/test.sh b/tasks/agg-p06-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s09/tests/test.sh +++ b/tasks/agg-p06-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s10/instruction.md b/tasks/agg-p06-n16-s10/instruction.md index 17dddcebb1a38d642707c9e410dad0c89d830fb7..b2dbec3d0f3048cf387c99c193a35cad3f00783a 100644 --- a/tasks/agg-p06-n16-s10/instruction.md +++ b/tasks/agg-p06-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s10/tests/test.sh b/tasks/agg-p06-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s10/tests/test.sh +++ b/tasks/agg-p06-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s11/instruction.md b/tasks/agg-p06-n16-s11/instruction.md index 57c62f85ec1ef4f9ca9aa899d016621c4b04432a..e1bd267ed9ac9c4fbf94870756f771be1265779a 100644 --- a/tasks/agg-p06-n16-s11/instruction.md +++ b/tasks/agg-p06-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s11/tests/test.sh b/tasks/agg-p06-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s11/tests/test.sh +++ b/tasks/agg-p06-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s12/instruction.md b/tasks/agg-p06-n16-s12/instruction.md index 5c5d544b57ab574592871eba4a9cf1c900af41ae..fcbafd4a7228b70ba628c7a82d64679c3d4fad1c 100644 --- a/tasks/agg-p06-n16-s12/instruction.md +++ b/tasks/agg-p06-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s12/tests/test.sh b/tasks/agg-p06-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s12/tests/test.sh +++ b/tasks/agg-p06-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s13/instruction.md b/tasks/agg-p06-n16-s13/instruction.md index bec568d59f85e2e30c1eb04f810b7ec136113a04..d047a7120223676abdd7f02b0240a56c724e3fff 100644 --- a/tasks/agg-p06-n16-s13/instruction.md +++ b/tasks/agg-p06-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s13/tests/test.sh b/tasks/agg-p06-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s13/tests/test.sh +++ b/tasks/agg-p06-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s14/instruction.md b/tasks/agg-p06-n16-s14/instruction.md index d398ea97722601a49a457530f502678c0a1433cf..e1c1f7d3b01724d8dea774465c5f5d8397b1d161 100644 --- a/tasks/agg-p06-n16-s14/instruction.md +++ b/tasks/agg-p06-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s14/tests/test.sh b/tasks/agg-p06-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s14/tests/test.sh +++ b/tasks/agg-p06-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s15/instruction.md b/tasks/agg-p06-n16-s15/instruction.md index a1e1d14ddbf968be7e060dd9f860572ccdbd16d1..99dfe0570e82593ebf42356aba3edfd1fd62d038 100644 --- a/tasks/agg-p06-n16-s15/instruction.md +++ b/tasks/agg-p06-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s15/tests/test.sh b/tasks/agg-p06-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s15/tests/test.sh +++ b/tasks/agg-p06-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p06-n16-s16/instruction.md b/tasks/agg-p06-n16-s16/instruction.md index 33c6e5250952f3077456a896c57a642ebd1c8d39..2ed4d1a65ed8a6a1ef17afdd17d82926d08e7770 100644 --- a/tasks/agg-p06-n16-s16/instruction.md +++ b/tasks/agg-p06-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p06-n16-s16/tests/test.sh b/tasks/agg-p06-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p06-n16-s16/tests/test.sh +++ b/tasks/agg-p06-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n01-s01/instruction.md b/tasks/agg-p07-n01-s01/instruction.md index 4a338f3bfabb446e95ee928c41b04d3fa186054e..3b3adf81a4c73e63b632da731de4670df0a833fc 100644 --- a/tasks/agg-p07-n01-s01/instruction.md +++ b/tasks/agg-p07-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is forty-nine. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p07-n01-s01/tests/test.sh b/tasks/agg-p07-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n01-s01/tests/test.sh +++ b/tasks/agg-p07-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n02-s01/instruction.md b/tasks/agg-p07-n02-s01/instruction.md index 36a77791cf51d46ecd89d0c6783c35f9132184e2..8e384ce8113a9dd8772b1974551ba6ff56c162ff 100644 --- a/tasks/agg-p07-n02-s01/instruction.md +++ b/tasks/agg-p07-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n02-s01/tests/test.sh b/tasks/agg-p07-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n02-s01/tests/test.sh +++ b/tasks/agg-p07-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n02-s02/instruction.md b/tasks/agg-p07-n02-s02/instruction.md index 32a14e0edea1dbf99540c9f3e40617407f006099..91f33583bff3386c621cb7691ae3d710f7c6d719 100644 --- a/tasks/agg-p07-n02-s02/instruction.md +++ b/tasks/agg-p07-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n02-s02/tests/test.sh b/tasks/agg-p07-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n02-s02/tests/test.sh +++ b/tasks/agg-p07-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n04-s01/instruction.md b/tasks/agg-p07-n04-s01/instruction.md index c73578c8e3f0d0f1dada19aa91aa8fa6cc5ce6d9..a00d7ab51cd0d846c5d26f931c8965a4cd858eca 100644 --- a/tasks/agg-p07-n04-s01/instruction.md +++ b/tasks/agg-p07-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n04-s01/tests/test.sh b/tasks/agg-p07-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n04-s01/tests/test.sh +++ b/tasks/agg-p07-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n04-s02/instruction.md b/tasks/agg-p07-n04-s02/instruction.md index d59f0bb832693f2ff4db4518640ba1d7223973e9..5646a1e56523ac12f29da21f0ac795a2ce32426c 100644 --- a/tasks/agg-p07-n04-s02/instruction.md +++ b/tasks/agg-p07-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n04-s02/tests/test.sh b/tasks/agg-p07-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n04-s02/tests/test.sh +++ b/tasks/agg-p07-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n04-s03/instruction.md b/tasks/agg-p07-n04-s03/instruction.md index 2fdd036d16482b9a65a4c12fbd6caac1b69095a8..f08e560b5d0e23c56ad897635078a6f7f241dd05 100644 --- a/tasks/agg-p07-n04-s03/instruction.md +++ b/tasks/agg-p07-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n04-s03/tests/test.sh b/tasks/agg-p07-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n04-s03/tests/test.sh +++ b/tasks/agg-p07-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n04-s04/instruction.md b/tasks/agg-p07-n04-s04/instruction.md index af29f7ab0f75076509388fa943bdfb4a4c0a5922..ab45d79ba5bf3f1b2a275dd1a83c78ad159fe742 100644 --- a/tasks/agg-p07-n04-s04/instruction.md +++ b/tasks/agg-p07-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n04-s04/tests/test.sh b/tasks/agg-p07-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n04-s04/tests/test.sh +++ b/tasks/agg-p07-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n06-s01/instruction.md b/tasks/agg-p07-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2acfaa4e57d45dcea9fe594d49bed02d3904ea57 --- /dev/null +++ b/tasks/agg-p07-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n06-s01/solution/solve.sh b/tasks/agg-p07-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d65f518b43e59cbf21b364a13784dab9dfe5dcd9 --- /dev/null +++ b/tasks/agg-p07-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[22, 36, 38, 48, 49, 54]' > "$answer" diff --git a/tasks/agg-p07-n06-s01/task.toml b/tasks/agg-p07-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..648004ba11262c6c5ed65deadad0b81a745894b4 --- /dev/null +++ b/tasks/agg-p07-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n06-s01/tests/expected.json b/tasks/agg-p07-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a1b615a806e193af606aa8eed84d6a6a6319ad3f --- /dev/null +++ b/tasks/agg-p07-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[22, 36, 38, 48, 49, 54] diff --git a/tasks/agg-p07-n06-s01/tests/test.sh b/tasks/agg-p07-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n06-s02/instruction.md b/tasks/agg-p07-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..646aa6fe77ffd0dcaac27a989fcd74a9b9cf343d --- /dev/null +++ b/tasks/agg-p07-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n06-s02/solution/solve.sh b/tasks/agg-p07-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d65f518b43e59cbf21b364a13784dab9dfe5dcd9 --- /dev/null +++ b/tasks/agg-p07-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[22, 36, 38, 48, 49, 54]' > "$answer" diff --git a/tasks/agg-p07-n06-s02/task.toml b/tasks/agg-p07-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f94c9c5c4c57e80569ff2e0a25fcccbeb0819554 --- /dev/null +++ b/tasks/agg-p07-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n06-s02/tests/expected.json b/tasks/agg-p07-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a1b615a806e193af606aa8eed84d6a6a6319ad3f --- /dev/null +++ b/tasks/agg-p07-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[22, 36, 38, 48, 49, 54] diff --git a/tasks/agg-p07-n06-s02/tests/test.sh b/tasks/agg-p07-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n06-s03/instruction.md b/tasks/agg-p07-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a0391fdc0975cceaca695a17de8d8a49acb4f08d --- /dev/null +++ b/tasks/agg-p07-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n06-s03/solution/solve.sh b/tasks/agg-p07-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d65f518b43e59cbf21b364a13784dab9dfe5dcd9 --- /dev/null +++ b/tasks/agg-p07-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[22, 36, 38, 48, 49, 54]' > "$answer" diff --git a/tasks/agg-p07-n06-s03/task.toml b/tasks/agg-p07-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..163202c6f91943ba246dfb6649ddd9fa71a6daf5 --- /dev/null +++ b/tasks/agg-p07-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n06-s03/tests/expected.json b/tasks/agg-p07-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a1b615a806e193af606aa8eed84d6a6a6319ad3f --- /dev/null +++ b/tasks/agg-p07-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[22, 36, 38, 48, 49, 54] diff --git a/tasks/agg-p07-n06-s03/tests/test.sh b/tasks/agg-p07-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n06-s04/instruction.md b/tasks/agg-p07-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8b253fb519682bf626feda0158e30db46a4e6c0f --- /dev/null +++ b/tasks/agg-p07-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n06-s04/solution/solve.sh b/tasks/agg-p07-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d65f518b43e59cbf21b364a13784dab9dfe5dcd9 --- /dev/null +++ b/tasks/agg-p07-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[22, 36, 38, 48, 49, 54]' > "$answer" diff --git a/tasks/agg-p07-n06-s04/task.toml b/tasks/agg-p07-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c60d5fc9fae8ee368bf6591d023950db31888eb2 --- /dev/null +++ b/tasks/agg-p07-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n06-s04/tests/expected.json b/tasks/agg-p07-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a1b615a806e193af606aa8eed84d6a6a6319ad3f --- /dev/null +++ b/tasks/agg-p07-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[22, 36, 38, 48, 49, 54] diff --git a/tasks/agg-p07-n06-s04/tests/test.sh b/tasks/agg-p07-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n06-s05/instruction.md b/tasks/agg-p07-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c51332c60dce3bcfa01bbc569eaefb90ebc3e043 --- /dev/null +++ b/tasks/agg-p07-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n06-s05/solution/solve.sh b/tasks/agg-p07-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d65f518b43e59cbf21b364a13784dab9dfe5dcd9 --- /dev/null +++ b/tasks/agg-p07-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[22, 36, 38, 48, 49, 54]' > "$answer" diff --git a/tasks/agg-p07-n06-s05/task.toml b/tasks/agg-p07-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a9ce7fda04b1994bcb1693624ccc15b1daf396f9 --- /dev/null +++ b/tasks/agg-p07-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n06-s05/tests/expected.json b/tasks/agg-p07-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a1b615a806e193af606aa8eed84d6a6a6319ad3f --- /dev/null +++ b/tasks/agg-p07-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[22, 36, 38, 48, 49, 54] diff --git a/tasks/agg-p07-n06-s05/tests/test.sh b/tasks/agg-p07-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n06-s06/instruction.md b/tasks/agg-p07-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..786d1fe5ab83a56dbefe27ab387d283f9bb9cdfa --- /dev/null +++ b/tasks/agg-p07-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n06-s06/solution/solve.sh b/tasks/agg-p07-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d65f518b43e59cbf21b364a13784dab9dfe5dcd9 --- /dev/null +++ b/tasks/agg-p07-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[22, 36, 38, 48, 49, 54]' > "$answer" diff --git a/tasks/agg-p07-n06-s06/task.toml b/tasks/agg-p07-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fd58244730b03bd6004f24240544b7fa42479140 --- /dev/null +++ b/tasks/agg-p07-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n06-s06/tests/expected.json b/tasks/agg-p07-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a1b615a806e193af606aa8eed84d6a6a6319ad3f --- /dev/null +++ b/tasks/agg-p07-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[22, 36, 38, 48, 49, 54] diff --git a/tasks/agg-p07-n06-s06/tests/test.sh b/tasks/agg-p07-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n08-s01/instruction.md b/tasks/agg-p07-n08-s01/instruction.md index 2977a346481de4a6052c0959cd91ba095dded4f4..6d88546e49edb41e682170da4fc85e4b71f8a6c7 100644 --- a/tasks/agg-p07-n08-s01/instruction.md +++ b/tasks/agg-p07-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n08-s01/tests/test.sh b/tasks/agg-p07-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n08-s01/tests/test.sh +++ b/tasks/agg-p07-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n08-s02/instruction.md b/tasks/agg-p07-n08-s02/instruction.md index 4eccb674ece1f5e87026a82210d8ef4929435c03..1c8272e27cf6f88e7404b4647a540b918219e839 100644 --- a/tasks/agg-p07-n08-s02/instruction.md +++ b/tasks/agg-p07-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n08-s02/tests/test.sh b/tasks/agg-p07-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n08-s02/tests/test.sh +++ b/tasks/agg-p07-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n08-s03/instruction.md b/tasks/agg-p07-n08-s03/instruction.md index e21142b6e0df055b0e0bb6899f7eab5e6cc92fb4..afc952163a35fd3b6411c5d3e8199ea1d02f0544 100644 --- a/tasks/agg-p07-n08-s03/instruction.md +++ b/tasks/agg-p07-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n08-s03/tests/test.sh b/tasks/agg-p07-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n08-s03/tests/test.sh +++ b/tasks/agg-p07-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n08-s04/instruction.md b/tasks/agg-p07-n08-s04/instruction.md index 9aeda7c18bda7e04cdb2b969682a97e7b7f2d3d5..c2e03bf5ff942c738d8c8b507766fe8a789de295 100644 --- a/tasks/agg-p07-n08-s04/instruction.md +++ b/tasks/agg-p07-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n08-s04/tests/test.sh b/tasks/agg-p07-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n08-s04/tests/test.sh +++ b/tasks/agg-p07-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n08-s05/instruction.md b/tasks/agg-p07-n08-s05/instruction.md index ee602d2ed51f86295f1f477b0dc17b27fbe00ab3..3c11876bf7d7979bedc0677067808c4383330064 100644 --- a/tasks/agg-p07-n08-s05/instruction.md +++ b/tasks/agg-p07-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n08-s05/tests/test.sh b/tasks/agg-p07-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n08-s05/tests/test.sh +++ b/tasks/agg-p07-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n08-s06/instruction.md b/tasks/agg-p07-n08-s06/instruction.md index 8e1b9f225dd41eb13af45ff90735dba5c7d221b8..b9565161529d3e10879a2835bc30196ea1a66220 100644 --- a/tasks/agg-p07-n08-s06/instruction.md +++ b/tasks/agg-p07-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n08-s06/tests/test.sh b/tasks/agg-p07-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n08-s06/tests/test.sh +++ b/tasks/agg-p07-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n08-s07/instruction.md b/tasks/agg-p07-n08-s07/instruction.md index 8fc5da9fd3f2fb4b928fc1ff5a73236e0d218b54..d868b319945fa8116452ca00f04e2b9e846d67e5 100644 --- a/tasks/agg-p07-n08-s07/instruction.md +++ b/tasks/agg-p07-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n08-s07/tests/test.sh b/tasks/agg-p07-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n08-s07/tests/test.sh +++ b/tasks/agg-p07-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n08-s08/instruction.md b/tasks/agg-p07-n08-s08/instruction.md index fb9a5a5e841fd2441b11cbee99000a82617ba549..c4d59599040c183c644da71859bea8cee1fe06cf 100644 --- a/tasks/agg-p07-n08-s08/instruction.md +++ b/tasks/agg-p07-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n08-s08/tests/test.sh b/tasks/agg-p07-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n08-s08/tests/test.sh +++ b/tasks/agg-p07-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n12-s01/instruction.md b/tasks/agg-p07-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a9ae9019b7ad29e5cdcfd17fa8d4d8750dfb4c89 --- /dev/null +++ b/tasks/agg-p07-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n12-s01/solution/solve.sh b/tasks/agg-p07-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c3c7813bf2620f2a859c7f17f3a03f704a535c4a --- /dev/null +++ b/tasks/agg-p07-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88]' > "$answer" diff --git a/tasks/agg-p07-n12-s01/task.toml b/tasks/agg-p07-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..182bdca3073ffafcec09a978ddd1ea73077f4f80 --- /dev/null +++ b/tasks/agg-p07-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n12-s01/tests/expected.json b/tasks/agg-p07-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..76dd698d73c155d5922fd7e5c3b9a1a525a8740b --- /dev/null +++ b/tasks/agg-p07-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88] diff --git a/tasks/agg-p07-n12-s01/tests/test.sh b/tasks/agg-p07-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n12-s02/instruction.md b/tasks/agg-p07-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9aaef5446517a1b0321eb9b44f6a98f04db290b5 --- /dev/null +++ b/tasks/agg-p07-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n12-s02/solution/solve.sh b/tasks/agg-p07-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c3c7813bf2620f2a859c7f17f3a03f704a535c4a --- /dev/null +++ b/tasks/agg-p07-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88]' > "$answer" diff --git a/tasks/agg-p07-n12-s02/task.toml b/tasks/agg-p07-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fa8b6a0145738d13c3b3b9c04c0c20f792a64859 --- /dev/null +++ b/tasks/agg-p07-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n12-s02/tests/expected.json b/tasks/agg-p07-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..76dd698d73c155d5922fd7e5c3b9a1a525a8740b --- /dev/null +++ b/tasks/agg-p07-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88] diff --git a/tasks/agg-p07-n12-s02/tests/test.sh b/tasks/agg-p07-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n12-s03/instruction.md b/tasks/agg-p07-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bb40c13254db093b772375b0bb70c64bc0b6f8b8 --- /dev/null +++ b/tasks/agg-p07-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n12-s03/solution/solve.sh b/tasks/agg-p07-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c3c7813bf2620f2a859c7f17f3a03f704a535c4a --- /dev/null +++ b/tasks/agg-p07-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88]' > "$answer" diff --git a/tasks/agg-p07-n12-s03/task.toml b/tasks/agg-p07-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d9ada7974a8b2654039cae648a674f38ab2639a3 --- /dev/null +++ b/tasks/agg-p07-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n12-s03/tests/expected.json b/tasks/agg-p07-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..76dd698d73c155d5922fd7e5c3b9a1a525a8740b --- /dev/null +++ b/tasks/agg-p07-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88] diff --git a/tasks/agg-p07-n12-s03/tests/test.sh b/tasks/agg-p07-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n12-s04/instruction.md b/tasks/agg-p07-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c8f325be4d0da26c010644a3007675a0c695c534 --- /dev/null +++ b/tasks/agg-p07-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n12-s04/solution/solve.sh b/tasks/agg-p07-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c3c7813bf2620f2a859c7f17f3a03f704a535c4a --- /dev/null +++ b/tasks/agg-p07-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88]' > "$answer" diff --git a/tasks/agg-p07-n12-s04/task.toml b/tasks/agg-p07-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ad95e4bfb19a969d79052f624cde5679fc3cc6bb --- /dev/null +++ b/tasks/agg-p07-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n12-s04/tests/expected.json b/tasks/agg-p07-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..76dd698d73c155d5922fd7e5c3b9a1a525a8740b --- /dev/null +++ b/tasks/agg-p07-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88] diff --git a/tasks/agg-p07-n12-s04/tests/test.sh b/tasks/agg-p07-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n12-s05/instruction.md b/tasks/agg-p07-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5937949c7bcb7a88691fdbc04d0f8ce8273fab17 --- /dev/null +++ b/tasks/agg-p07-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n12-s05/solution/solve.sh b/tasks/agg-p07-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c3c7813bf2620f2a859c7f17f3a03f704a535c4a --- /dev/null +++ b/tasks/agg-p07-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88]' > "$answer" diff --git a/tasks/agg-p07-n12-s05/task.toml b/tasks/agg-p07-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..74db5ab06a14a4ad703c10d5e4a4e881b1b47dcb --- /dev/null +++ b/tasks/agg-p07-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n12-s05/tests/expected.json b/tasks/agg-p07-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..76dd698d73c155d5922fd7e5c3b9a1a525a8740b --- /dev/null +++ b/tasks/agg-p07-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88] diff --git a/tasks/agg-p07-n12-s05/tests/test.sh b/tasks/agg-p07-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n12-s06/instruction.md b/tasks/agg-p07-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b53986e9d0f1dda9020e6d798d3ea3ceceb7b772 --- /dev/null +++ b/tasks/agg-p07-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n12-s06/solution/solve.sh b/tasks/agg-p07-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c3c7813bf2620f2a859c7f17f3a03f704a535c4a --- /dev/null +++ b/tasks/agg-p07-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88]' > "$answer" diff --git a/tasks/agg-p07-n12-s06/task.toml b/tasks/agg-p07-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6e635313e46e681eb186b62a26e1012f240f4fd7 --- /dev/null +++ b/tasks/agg-p07-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n12-s06/tests/expected.json b/tasks/agg-p07-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..76dd698d73c155d5922fd7e5c3b9a1a525a8740b --- /dev/null +++ b/tasks/agg-p07-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88] diff --git a/tasks/agg-p07-n12-s06/tests/test.sh b/tasks/agg-p07-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n12-s07/instruction.md b/tasks/agg-p07-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ca689d19db465172c22b2b5dc9acaa4689858529 --- /dev/null +++ b/tasks/agg-p07-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n12-s07/solution/solve.sh b/tasks/agg-p07-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c3c7813bf2620f2a859c7f17f3a03f704a535c4a --- /dev/null +++ b/tasks/agg-p07-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88]' > "$answer" diff --git a/tasks/agg-p07-n12-s07/task.toml b/tasks/agg-p07-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ebbc3b155eb752a3cb7267ded99c75dbb6413590 --- /dev/null +++ b/tasks/agg-p07-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n12-s07/tests/expected.json b/tasks/agg-p07-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..76dd698d73c155d5922fd7e5c3b9a1a525a8740b --- /dev/null +++ b/tasks/agg-p07-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88] diff --git a/tasks/agg-p07-n12-s07/tests/test.sh b/tasks/agg-p07-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n12-s08/instruction.md b/tasks/agg-p07-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7201ad16b41f6e2d149e2c45df4bcd774a258af1 --- /dev/null +++ b/tasks/agg-p07-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n12-s08/solution/solve.sh b/tasks/agg-p07-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c3c7813bf2620f2a859c7f17f3a03f704a535c4a --- /dev/null +++ b/tasks/agg-p07-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88]' > "$answer" diff --git a/tasks/agg-p07-n12-s08/task.toml b/tasks/agg-p07-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1e6fb4b563b30855a71d56653fd6711c55c32abb --- /dev/null +++ b/tasks/agg-p07-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n12-s08/tests/expected.json b/tasks/agg-p07-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..76dd698d73c155d5922fd7e5c3b9a1a525a8740b --- /dev/null +++ b/tasks/agg-p07-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88] diff --git a/tasks/agg-p07-n12-s08/tests/test.sh b/tasks/agg-p07-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n12-s09/instruction.md b/tasks/agg-p07-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6e844f7a3e8d345b3d28255a1eef90feb406b747 --- /dev/null +++ b/tasks/agg-p07-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n12-s09/solution/solve.sh b/tasks/agg-p07-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c3c7813bf2620f2a859c7f17f3a03f704a535c4a --- /dev/null +++ b/tasks/agg-p07-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88]' > "$answer" diff --git a/tasks/agg-p07-n12-s09/task.toml b/tasks/agg-p07-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..42b4746c7f7e4046c1099b0eaef5f60716687c0c --- /dev/null +++ b/tasks/agg-p07-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n12-s09/tests/expected.json b/tasks/agg-p07-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..76dd698d73c155d5922fd7e5c3b9a1a525a8740b --- /dev/null +++ b/tasks/agg-p07-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88] diff --git a/tasks/agg-p07-n12-s09/tests/test.sh b/tasks/agg-p07-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n12-s10/instruction.md b/tasks/agg-p07-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..297e7df5ad0e1e0ae0182d7fbd8be00d892a2f7e --- /dev/null +++ b/tasks/agg-p07-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n12-s10/solution/solve.sh b/tasks/agg-p07-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c3c7813bf2620f2a859c7f17f3a03f704a535c4a --- /dev/null +++ b/tasks/agg-p07-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88]' > "$answer" diff --git a/tasks/agg-p07-n12-s10/task.toml b/tasks/agg-p07-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6dda987dfe3fd921213eb69c90658d29053a7efa --- /dev/null +++ b/tasks/agg-p07-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n12-s10/tests/expected.json b/tasks/agg-p07-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..76dd698d73c155d5922fd7e5c3b9a1a525a8740b --- /dev/null +++ b/tasks/agg-p07-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88] diff --git a/tasks/agg-p07-n12-s10/tests/test.sh b/tasks/agg-p07-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n12-s11/instruction.md b/tasks/agg-p07-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..183d4ee3e6b3a3123db0d338a5b1b7ad65451408 --- /dev/null +++ b/tasks/agg-p07-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n12-s11/solution/solve.sh b/tasks/agg-p07-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c3c7813bf2620f2a859c7f17f3a03f704a535c4a --- /dev/null +++ b/tasks/agg-p07-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88]' > "$answer" diff --git a/tasks/agg-p07-n12-s11/task.toml b/tasks/agg-p07-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d7c6d838dba8e66fd4ebf36ff173b1e0c2171d01 --- /dev/null +++ b/tasks/agg-p07-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n12-s11/tests/expected.json b/tasks/agg-p07-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..76dd698d73c155d5922fd7e5c3b9a1a525a8740b --- /dev/null +++ b/tasks/agg-p07-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88] diff --git a/tasks/agg-p07-n12-s11/tests/test.sh b/tasks/agg-p07-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n12-s12/instruction.md b/tasks/agg-p07-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..054dc42296a82036d581d99f90bd071c5bc61a63 --- /dev/null +++ b/tasks/agg-p07-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n12-s12/solution/solve.sh b/tasks/agg-p07-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c3c7813bf2620f2a859c7f17f3a03f704a535c4a --- /dev/null +++ b/tasks/agg-p07-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88]' > "$answer" diff --git a/tasks/agg-p07-n12-s12/task.toml b/tasks/agg-p07-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b33a5907ce9e7a48bbd91037104787e4fd5f23b2 --- /dev/null +++ b/tasks/agg-p07-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p07-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 7 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p07-n12-s12/tests/expected.json b/tasks/agg-p07-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..76dd698d73c155d5922fd7e5c3b9a1a525a8740b --- /dev/null +++ b/tasks/agg-p07-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[8, 16, 22, 25, 36, 38, 48, 49, 54, 66, 78, 88] diff --git a/tasks/agg-p07-n12-s12/tests/test.sh b/tasks/agg-p07-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p07-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p07-n16-s01/instruction.md b/tasks/agg-p07-n16-s01/instruction.md index 8e07e4d36fb62c2d2904ca839b34d4b0744c309f..e4175fb2ee970049448cc7af46e926ef2e770c0c 100644 --- a/tasks/agg-p07-n16-s01/instruction.md +++ b/tasks/agg-p07-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s01/tests/test.sh b/tasks/agg-p07-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s01/tests/test.sh +++ b/tasks/agg-p07-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s02/instruction.md b/tasks/agg-p07-n16-s02/instruction.md index 552ad7b188277feadeb521fd17ec24a6f1f8f5ae..50bdd007515ead22fc5cdc1b26c44d0d9cdd48d1 100644 --- a/tasks/agg-p07-n16-s02/instruction.md +++ b/tasks/agg-p07-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s02/tests/test.sh b/tasks/agg-p07-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s02/tests/test.sh +++ b/tasks/agg-p07-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s03/instruction.md b/tasks/agg-p07-n16-s03/instruction.md index d398ea97722601a49a457530f502678c0a1433cf..e1c1f7d3b01724d8dea774465c5f5d8397b1d161 100644 --- a/tasks/agg-p07-n16-s03/instruction.md +++ b/tasks/agg-p07-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s03/tests/test.sh b/tasks/agg-p07-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s03/tests/test.sh +++ b/tasks/agg-p07-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s04/instruction.md b/tasks/agg-p07-n16-s04/instruction.md index 38e83aee5771fa00d5091767999e55e04acb180b..faf993ab529fff7ee5de3df9b24769934f987d78 100644 --- a/tasks/agg-p07-n16-s04/instruction.md +++ b/tasks/agg-p07-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s04/tests/test.sh b/tasks/agg-p07-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s04/tests/test.sh +++ b/tasks/agg-p07-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s05/instruction.md b/tasks/agg-p07-n16-s05/instruction.md index a1e1d14ddbf968be7e060dd9f860572ccdbd16d1..99dfe0570e82593ebf42356aba3edfd1fd62d038 100644 --- a/tasks/agg-p07-n16-s05/instruction.md +++ b/tasks/agg-p07-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s05/tests/test.sh b/tasks/agg-p07-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s05/tests/test.sh +++ b/tasks/agg-p07-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s06/instruction.md b/tasks/agg-p07-n16-s06/instruction.md index ac5d07700d94f2ac8dcfe94fa7b7a0669218f24c..b6fbdfaa15c801714d533bc10b7c3a21161186fb 100644 --- a/tasks/agg-p07-n16-s06/instruction.md +++ b/tasks/agg-p07-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s06/tests/test.sh b/tasks/agg-p07-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s06/tests/test.sh +++ b/tasks/agg-p07-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s07/instruction.md b/tasks/agg-p07-n16-s07/instruction.md index f197f79da6e4638891b46f2053909c167ec13c32..856f7627093ea9ba708f7c4461f757925253fef9 100644 --- a/tasks/agg-p07-n16-s07/instruction.md +++ b/tasks/agg-p07-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s07/tests/test.sh b/tasks/agg-p07-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s07/tests/test.sh +++ b/tasks/agg-p07-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s08/instruction.md b/tasks/agg-p07-n16-s08/instruction.md index 99a7f97eb2774bf91fcf02fc9e18c71f2c746d9d..b0c86232070beace6f6b66df51114731c8869870 100644 --- a/tasks/agg-p07-n16-s08/instruction.md +++ b/tasks/agg-p07-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s08/tests/test.sh b/tasks/agg-p07-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s08/tests/test.sh +++ b/tasks/agg-p07-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s09/instruction.md b/tasks/agg-p07-n16-s09/instruction.md index bec568d59f85e2e30c1eb04f810b7ec136113a04..d047a7120223676abdd7f02b0240a56c724e3fff 100644 --- a/tasks/agg-p07-n16-s09/instruction.md +++ b/tasks/agg-p07-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s09/tests/test.sh b/tasks/agg-p07-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s09/tests/test.sh +++ b/tasks/agg-p07-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s10/instruction.md b/tasks/agg-p07-n16-s10/instruction.md index 04c3f6729149d2802728807768786a453bb32941..66fed180f5ece962b8f35828f82d008e1814560f 100644 --- a/tasks/agg-p07-n16-s10/instruction.md +++ b/tasks/agg-p07-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s10/tests/test.sh b/tasks/agg-p07-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s10/tests/test.sh +++ b/tasks/agg-p07-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s11/instruction.md b/tasks/agg-p07-n16-s11/instruction.md index 8e668cd99b85cf802939dffe8e766b769fcc702e..87e4a5f52a7382cfe533f0cb59ccf7425210c8fe 100644 --- a/tasks/agg-p07-n16-s11/instruction.md +++ b/tasks/agg-p07-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s11/tests/test.sh b/tasks/agg-p07-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s11/tests/test.sh +++ b/tasks/agg-p07-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s12/instruction.md b/tasks/agg-p07-n16-s12/instruction.md index bd54876511397bdb80a3c3299556503e1fd15da5..ffc3934425adafa34ada41ff5621db5d0f97a3bb 100644 --- a/tasks/agg-p07-n16-s12/instruction.md +++ b/tasks/agg-p07-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s12/tests/test.sh b/tasks/agg-p07-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s12/tests/test.sh +++ b/tasks/agg-p07-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s13/instruction.md b/tasks/agg-p07-n16-s13/instruction.md index 19d65d896f0e0b5ac5235a050fd89f11a849ba13..55251970885280efd8da19f11685ddf032af9c2d 100644 --- a/tasks/agg-p07-n16-s13/instruction.md +++ b/tasks/agg-p07-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s13/tests/test.sh b/tasks/agg-p07-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s13/tests/test.sh +++ b/tasks/agg-p07-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s14/instruction.md b/tasks/agg-p07-n16-s14/instruction.md index 756b66e7e1661b13390451604d8a217c6028d32d..0d5d43f3e734b37862973953434a82fefb583200 100644 --- a/tasks/agg-p07-n16-s14/instruction.md +++ b/tasks/agg-p07-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s14/tests/test.sh b/tasks/agg-p07-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s14/tests/test.sh +++ b/tasks/agg-p07-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s15/instruction.md b/tasks/agg-p07-n16-s15/instruction.md index 07c9e57a88a9821b15aef8e576670581ef52b8cf..f17e7c1550785116b92d6c8da78aeb05d8edf6c0 100644 --- a/tasks/agg-p07-n16-s15/instruction.md +++ b/tasks/agg-p07-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s15/tests/test.sh b/tasks/agg-p07-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s15/tests/test.sh +++ b/tasks/agg-p07-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p07-n16-s16/instruction.md b/tasks/agg-p07-n16-s16/instruction.md index ebbf18dd1885eca56e4b99d9ba0f301603987c59..967cbe42235491e28138a2858f78709704a1bd82 100644 --- a/tasks/agg-p07-n16-s16/instruction.md +++ b/tasks/agg-p07-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p07-n16-s16/tests/test.sh b/tasks/agg-p07-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p07-n16-s16/tests/test.sh +++ b/tasks/agg-p07-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n01-s01/instruction.md b/tasks/agg-p08-n01-s01/instruction.md index 8b183a410f6784b4c2401e33f3404029ba45b663..cfe0a5390fb2b6a15328ff2764e870f0aedbbb24 100644 --- a/tasks/agg-p08-n01-s01/instruction.md +++ b/tasks/agg-p08-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is thirty-seven. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p08-n01-s01/tests/test.sh b/tasks/agg-p08-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n01-s01/tests/test.sh +++ b/tasks/agg-p08-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n02-s01/instruction.md b/tasks/agg-p08-n02-s01/instruction.md index a0f5d6312615f15532c609835c393db0d12fe574..60942ac5c12598ab8f5115caa263a4e08a18a959 100644 --- a/tasks/agg-p08-n02-s01/instruction.md +++ b/tasks/agg-p08-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n02-s01/tests/test.sh b/tasks/agg-p08-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n02-s01/tests/test.sh +++ b/tasks/agg-p08-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n02-s02/instruction.md b/tasks/agg-p08-n02-s02/instruction.md index f7d66ca758c425370551bcb6e22062cbefbd9f97..64ec0a909104efc7c7b0bbd273ba187f2b7e492a 100644 --- a/tasks/agg-p08-n02-s02/instruction.md +++ b/tasks/agg-p08-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n02-s02/tests/test.sh b/tasks/agg-p08-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n02-s02/tests/test.sh +++ b/tasks/agg-p08-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n04-s01/instruction.md b/tasks/agg-p08-n04-s01/instruction.md index e277410d31e98e54fee347c8344a718ced81e639..a341ab49f244ade6a8766079f432438a2111a896 100644 --- a/tasks/agg-p08-n04-s01/instruction.md +++ b/tasks/agg-p08-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n04-s01/tests/test.sh b/tasks/agg-p08-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n04-s01/tests/test.sh +++ b/tasks/agg-p08-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n04-s02/instruction.md b/tasks/agg-p08-n04-s02/instruction.md index 430467a8c33661604553077a8a27e968376d25e5..080d5e6688850a817b1442e6f0fdcbe6a87cf876 100644 --- a/tasks/agg-p08-n04-s02/instruction.md +++ b/tasks/agg-p08-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n04-s02/tests/test.sh b/tasks/agg-p08-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n04-s02/tests/test.sh +++ b/tasks/agg-p08-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n04-s03/instruction.md b/tasks/agg-p08-n04-s03/instruction.md index 710f629ccf5142ea8ee0ed83d0f5e26f17b2a9f7..fda8fc5dde6070d9bbc81bec80fa565d092f5bb3 100644 --- a/tasks/agg-p08-n04-s03/instruction.md +++ b/tasks/agg-p08-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n04-s03/tests/test.sh b/tasks/agg-p08-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n04-s03/tests/test.sh +++ b/tasks/agg-p08-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n04-s04/instruction.md b/tasks/agg-p08-n04-s04/instruction.md index 4921c497e5aeedbc467d8325039aded3f2118521..426adff736b3a07fa98c9decf8a3b2099bce3be5 100644 --- a/tasks/agg-p08-n04-s04/instruction.md +++ b/tasks/agg-p08-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n04-s04/tests/test.sh b/tasks/agg-p08-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n04-s04/tests/test.sh +++ b/tasks/agg-p08-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n06-s01/instruction.md b/tasks/agg-p08-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b24b39ec78a0cf7e450c5ad8eba4aa7d5a4a5b36 --- /dev/null +++ b/tasks/agg-p08-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n06-s01/solution/solve.sh b/tasks/agg-p08-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..38456ece5e1dfa7043f32aedf6a887ae330f4b57 --- /dev/null +++ b/tasks/agg-p08-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[37, 44, 66, 68, 71, 88]' > "$answer" diff --git a/tasks/agg-p08-n06-s01/task.toml b/tasks/agg-p08-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e8c3806e6f4eca1352abb7ae6ee90de7e0fbc232 --- /dev/null +++ b/tasks/agg-p08-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n06-s01/tests/expected.json b/tasks/agg-p08-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..991d2a98443dc8b822c1ff14db732a807fa365d2 --- /dev/null +++ b/tasks/agg-p08-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[37, 44, 66, 68, 71, 88] diff --git a/tasks/agg-p08-n06-s01/tests/test.sh b/tasks/agg-p08-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n06-s02/instruction.md b/tasks/agg-p08-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c10b04dc835d0dca589f77fcc2261a294978adf2 --- /dev/null +++ b/tasks/agg-p08-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n06-s02/solution/solve.sh b/tasks/agg-p08-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..38456ece5e1dfa7043f32aedf6a887ae330f4b57 --- /dev/null +++ b/tasks/agg-p08-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[37, 44, 66, 68, 71, 88]' > "$answer" diff --git a/tasks/agg-p08-n06-s02/task.toml b/tasks/agg-p08-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6b6e927acca0fb7b755664440d5b10e07d1acef1 --- /dev/null +++ b/tasks/agg-p08-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n06-s02/tests/expected.json b/tasks/agg-p08-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..991d2a98443dc8b822c1ff14db732a807fa365d2 --- /dev/null +++ b/tasks/agg-p08-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[37, 44, 66, 68, 71, 88] diff --git a/tasks/agg-p08-n06-s02/tests/test.sh b/tasks/agg-p08-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n06-s03/instruction.md b/tasks/agg-p08-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0fe2a8811c726ac28727f6150ebaf8ef2a18e8b4 --- /dev/null +++ b/tasks/agg-p08-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n06-s03/solution/solve.sh b/tasks/agg-p08-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..38456ece5e1dfa7043f32aedf6a887ae330f4b57 --- /dev/null +++ b/tasks/agg-p08-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[37, 44, 66, 68, 71, 88]' > "$answer" diff --git a/tasks/agg-p08-n06-s03/task.toml b/tasks/agg-p08-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cd335596dd0d2212f1d62376eb4d77ccbe207300 --- /dev/null +++ b/tasks/agg-p08-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n06-s03/tests/expected.json b/tasks/agg-p08-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..991d2a98443dc8b822c1ff14db732a807fa365d2 --- /dev/null +++ b/tasks/agg-p08-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[37, 44, 66, 68, 71, 88] diff --git a/tasks/agg-p08-n06-s03/tests/test.sh b/tasks/agg-p08-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n06-s04/instruction.md b/tasks/agg-p08-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6dcbc105c872e1a8124f422226220a38a629c510 --- /dev/null +++ b/tasks/agg-p08-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n06-s04/solution/solve.sh b/tasks/agg-p08-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..38456ece5e1dfa7043f32aedf6a887ae330f4b57 --- /dev/null +++ b/tasks/agg-p08-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[37, 44, 66, 68, 71, 88]' > "$answer" diff --git a/tasks/agg-p08-n06-s04/task.toml b/tasks/agg-p08-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ee28418606c0f8cba792eae5814ff9f9401ce3ea --- /dev/null +++ b/tasks/agg-p08-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n06-s04/tests/expected.json b/tasks/agg-p08-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..991d2a98443dc8b822c1ff14db732a807fa365d2 --- /dev/null +++ b/tasks/agg-p08-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[37, 44, 66, 68, 71, 88] diff --git a/tasks/agg-p08-n06-s04/tests/test.sh b/tasks/agg-p08-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n06-s05/instruction.md b/tasks/agg-p08-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b852d926c8b9ec17901e2d02456a03cfa3f7bf78 --- /dev/null +++ b/tasks/agg-p08-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n06-s05/solution/solve.sh b/tasks/agg-p08-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..38456ece5e1dfa7043f32aedf6a887ae330f4b57 --- /dev/null +++ b/tasks/agg-p08-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[37, 44, 66, 68, 71, 88]' > "$answer" diff --git a/tasks/agg-p08-n06-s05/task.toml b/tasks/agg-p08-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..192f1686905cee4beec50c8da012c8f89758d4b7 --- /dev/null +++ b/tasks/agg-p08-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n06-s05/tests/expected.json b/tasks/agg-p08-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..991d2a98443dc8b822c1ff14db732a807fa365d2 --- /dev/null +++ b/tasks/agg-p08-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[37, 44, 66, 68, 71, 88] diff --git a/tasks/agg-p08-n06-s05/tests/test.sh b/tasks/agg-p08-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n06-s06/instruction.md b/tasks/agg-p08-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1c5e23125c4fa293fd0f92edbbb3abcdd56d4c59 --- /dev/null +++ b/tasks/agg-p08-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n06-s06/solution/solve.sh b/tasks/agg-p08-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..38456ece5e1dfa7043f32aedf6a887ae330f4b57 --- /dev/null +++ b/tasks/agg-p08-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[37, 44, 66, 68, 71, 88]' > "$answer" diff --git a/tasks/agg-p08-n06-s06/task.toml b/tasks/agg-p08-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2454f9190d39d2bc320af2d36cd31ce5b30899e5 --- /dev/null +++ b/tasks/agg-p08-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n06-s06/tests/expected.json b/tasks/agg-p08-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..991d2a98443dc8b822c1ff14db732a807fa365d2 --- /dev/null +++ b/tasks/agg-p08-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[37, 44, 66, 68, 71, 88] diff --git a/tasks/agg-p08-n06-s06/tests/test.sh b/tasks/agg-p08-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n08-s01/instruction.md b/tasks/agg-p08-n08-s01/instruction.md index d28771240990d9554944b9ef68d9203e0acd7f13..99290acfb8baa2927750e2841040ecf9ddb5f1fa 100644 --- a/tasks/agg-p08-n08-s01/instruction.md +++ b/tasks/agg-p08-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n08-s01/tests/test.sh b/tasks/agg-p08-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n08-s01/tests/test.sh +++ b/tasks/agg-p08-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n08-s02/instruction.md b/tasks/agg-p08-n08-s02/instruction.md index b972a48112ea31bbb92b19d1817bc5119ac04601..f5506dd4b4102b3440ace8d4668dab6d0b4cb826 100644 --- a/tasks/agg-p08-n08-s02/instruction.md +++ b/tasks/agg-p08-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n08-s02/tests/test.sh b/tasks/agg-p08-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n08-s02/tests/test.sh +++ b/tasks/agg-p08-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n08-s03/instruction.md b/tasks/agg-p08-n08-s03/instruction.md index 8fc5da9fd3f2fb4b928fc1ff5a73236e0d218b54..d868b319945fa8116452ca00f04e2b9e846d67e5 100644 --- a/tasks/agg-p08-n08-s03/instruction.md +++ b/tasks/agg-p08-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n08-s03/tests/test.sh b/tasks/agg-p08-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n08-s03/tests/test.sh +++ b/tasks/agg-p08-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n08-s04/instruction.md b/tasks/agg-p08-n08-s04/instruction.md index fde113c01e4acfbeb8da7ffabf1e13aba553efcb..88ddcffb3959c9bd9103a75fdec6a10918b46528 100644 --- a/tasks/agg-p08-n08-s04/instruction.md +++ b/tasks/agg-p08-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n08-s04/tests/test.sh b/tasks/agg-p08-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n08-s04/tests/test.sh +++ b/tasks/agg-p08-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n08-s05/instruction.md b/tasks/agg-p08-n08-s05/instruction.md index ec71f13b5946962c63788849abcae6208cb70629..ef1dffc1dcd1591d345fdae84de25e3aec26953a 100644 --- a/tasks/agg-p08-n08-s05/instruction.md +++ b/tasks/agg-p08-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n08-s05/tests/test.sh b/tasks/agg-p08-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n08-s05/tests/test.sh +++ b/tasks/agg-p08-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n08-s06/instruction.md b/tasks/agg-p08-n08-s06/instruction.md index 45b59ec949464e2c81423a8f183e17974a93c05c..b0bcae2eeaf25f778f80af13790eba76351df62c 100644 --- a/tasks/agg-p08-n08-s06/instruction.md +++ b/tasks/agg-p08-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n08-s06/tests/test.sh b/tasks/agg-p08-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n08-s06/tests/test.sh +++ b/tasks/agg-p08-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n08-s07/instruction.md b/tasks/agg-p08-n08-s07/instruction.md index f29ea0102313bedab13265b505199649c600c3a4..4cff8bf0403a37ab4d2713f1a27510d66149fd9b 100644 --- a/tasks/agg-p08-n08-s07/instruction.md +++ b/tasks/agg-p08-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n08-s07/tests/test.sh b/tasks/agg-p08-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n08-s07/tests/test.sh +++ b/tasks/agg-p08-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n08-s08/instruction.md b/tasks/agg-p08-n08-s08/instruction.md index 3db91c415e1fee104109b51426264d7f82e4a8ac..37cf5609ab85a6c14a3ed2778f40e1a369d56e75 100644 --- a/tasks/agg-p08-n08-s08/instruction.md +++ b/tasks/agg-p08-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n08-s08/tests/test.sh b/tasks/agg-p08-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n08-s08/tests/test.sh +++ b/tasks/agg-p08-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n12-s01/instruction.md b/tasks/agg-p08-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f8a7f84dc10e74d2d1efa1c93d0465b237cf01e --- /dev/null +++ b/tasks/agg-p08-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n12-s01/solution/solve.sh b/tasks/agg-p08-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..07adda3aaa85a93b6f6a866544428fd21f3295c3 --- /dev/null +++ b/tasks/agg-p08-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88]' > "$answer" diff --git a/tasks/agg-p08-n12-s01/task.toml b/tasks/agg-p08-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..caa6e79250e5482e370ee711dc69ecd578c988db --- /dev/null +++ b/tasks/agg-p08-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n12-s01/tests/expected.json b/tasks/agg-p08-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1b06c4a76e1ac948e29f08f94e62525c0e4b1399 --- /dev/null +++ b/tasks/agg-p08-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88] diff --git a/tasks/agg-p08-n12-s01/tests/test.sh b/tasks/agg-p08-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n12-s02/instruction.md b/tasks/agg-p08-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6f3f8fe41060e201182cc94c7cf026320c69b36b --- /dev/null +++ b/tasks/agg-p08-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n12-s02/solution/solve.sh b/tasks/agg-p08-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..07adda3aaa85a93b6f6a866544428fd21f3295c3 --- /dev/null +++ b/tasks/agg-p08-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88]' > "$answer" diff --git a/tasks/agg-p08-n12-s02/task.toml b/tasks/agg-p08-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6e3a442bf27f59bc14c0ad5218fd53d834e8b34d --- /dev/null +++ b/tasks/agg-p08-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n12-s02/tests/expected.json b/tasks/agg-p08-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1b06c4a76e1ac948e29f08f94e62525c0e4b1399 --- /dev/null +++ b/tasks/agg-p08-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88] diff --git a/tasks/agg-p08-n12-s02/tests/test.sh b/tasks/agg-p08-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n12-s03/instruction.md b/tasks/agg-p08-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ca689d19db465172c22b2b5dc9acaa4689858529 --- /dev/null +++ b/tasks/agg-p08-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n12-s03/solution/solve.sh b/tasks/agg-p08-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..07adda3aaa85a93b6f6a866544428fd21f3295c3 --- /dev/null +++ b/tasks/agg-p08-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88]' > "$answer" diff --git a/tasks/agg-p08-n12-s03/task.toml b/tasks/agg-p08-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0555894f4ee25fc34f47af87b8c0136dc6bd1a57 --- /dev/null +++ b/tasks/agg-p08-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n12-s03/tests/expected.json b/tasks/agg-p08-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1b06c4a76e1ac948e29f08f94e62525c0e4b1399 --- /dev/null +++ b/tasks/agg-p08-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88] diff --git a/tasks/agg-p08-n12-s03/tests/test.sh b/tasks/agg-p08-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n12-s04/instruction.md b/tasks/agg-p08-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..60de2988fff25a8c1506580c1ef0e053a02c16f7 --- /dev/null +++ b/tasks/agg-p08-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n12-s04/solution/solve.sh b/tasks/agg-p08-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..07adda3aaa85a93b6f6a866544428fd21f3295c3 --- /dev/null +++ b/tasks/agg-p08-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88]' > "$answer" diff --git a/tasks/agg-p08-n12-s04/task.toml b/tasks/agg-p08-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7334232b76c45a94b76ee0018061521ee65de61f --- /dev/null +++ b/tasks/agg-p08-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n12-s04/tests/expected.json b/tasks/agg-p08-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1b06c4a76e1ac948e29f08f94e62525c0e4b1399 --- /dev/null +++ b/tasks/agg-p08-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88] diff --git a/tasks/agg-p08-n12-s04/tests/test.sh b/tasks/agg-p08-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n12-s05/instruction.md b/tasks/agg-p08-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6e844f7a3e8d345b3d28255a1eef90feb406b747 --- /dev/null +++ b/tasks/agg-p08-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n12-s05/solution/solve.sh b/tasks/agg-p08-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..07adda3aaa85a93b6f6a866544428fd21f3295c3 --- /dev/null +++ b/tasks/agg-p08-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88]' > "$answer" diff --git a/tasks/agg-p08-n12-s05/task.toml b/tasks/agg-p08-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..72503168d310e00b4c2c70efd227adc7e3285e96 --- /dev/null +++ b/tasks/agg-p08-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n12-s05/tests/expected.json b/tasks/agg-p08-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1b06c4a76e1ac948e29f08f94e62525c0e4b1399 --- /dev/null +++ b/tasks/agg-p08-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88] diff --git a/tasks/agg-p08-n12-s05/tests/test.sh b/tasks/agg-p08-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n12-s06/instruction.md b/tasks/agg-p08-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..89a1678c978d8a496615bec8d74744ae635b59ec --- /dev/null +++ b/tasks/agg-p08-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n12-s06/solution/solve.sh b/tasks/agg-p08-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..07adda3aaa85a93b6f6a866544428fd21f3295c3 --- /dev/null +++ b/tasks/agg-p08-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88]' > "$answer" diff --git a/tasks/agg-p08-n12-s06/task.toml b/tasks/agg-p08-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..34732b48cb65a4612054f4182f9aad6126bec778 --- /dev/null +++ b/tasks/agg-p08-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n12-s06/tests/expected.json b/tasks/agg-p08-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1b06c4a76e1ac948e29f08f94e62525c0e4b1399 --- /dev/null +++ b/tasks/agg-p08-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88] diff --git a/tasks/agg-p08-n12-s06/tests/test.sh b/tasks/agg-p08-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n12-s07/instruction.md b/tasks/agg-p08-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..710a88fca3c54632b531e8326d63c5a443adad46 --- /dev/null +++ b/tasks/agg-p08-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n12-s07/solution/solve.sh b/tasks/agg-p08-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..07adda3aaa85a93b6f6a866544428fd21f3295c3 --- /dev/null +++ b/tasks/agg-p08-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88]' > "$answer" diff --git a/tasks/agg-p08-n12-s07/task.toml b/tasks/agg-p08-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..039f8a64f949298947c9c0cf9a021319e35d34f3 --- /dev/null +++ b/tasks/agg-p08-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n12-s07/tests/expected.json b/tasks/agg-p08-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1b06c4a76e1ac948e29f08f94e62525c0e4b1399 --- /dev/null +++ b/tasks/agg-p08-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88] diff --git a/tasks/agg-p08-n12-s07/tests/test.sh b/tasks/agg-p08-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n12-s08/instruction.md b/tasks/agg-p08-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..118bd725edb89efa2a1d06b9a496624d12c54355 --- /dev/null +++ b/tasks/agg-p08-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n12-s08/solution/solve.sh b/tasks/agg-p08-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..07adda3aaa85a93b6f6a866544428fd21f3295c3 --- /dev/null +++ b/tasks/agg-p08-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88]' > "$answer" diff --git a/tasks/agg-p08-n12-s08/task.toml b/tasks/agg-p08-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3f62ebb21f8b0cc60eecfd4fd1ce499510ca8619 --- /dev/null +++ b/tasks/agg-p08-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n12-s08/tests/expected.json b/tasks/agg-p08-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1b06c4a76e1ac948e29f08f94e62525c0e4b1399 --- /dev/null +++ b/tasks/agg-p08-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88] diff --git a/tasks/agg-p08-n12-s08/tests/test.sh b/tasks/agg-p08-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n12-s09/instruction.md b/tasks/agg-p08-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2f01a3e73dbd4b8b1058dd60451773afa73f14c7 --- /dev/null +++ b/tasks/agg-p08-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n12-s09/solution/solve.sh b/tasks/agg-p08-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..07adda3aaa85a93b6f6a866544428fd21f3295c3 --- /dev/null +++ b/tasks/agg-p08-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88]' > "$answer" diff --git a/tasks/agg-p08-n12-s09/task.toml b/tasks/agg-p08-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7e3a254a71ebe7dec70ba45535e2808b850cdfe9 --- /dev/null +++ b/tasks/agg-p08-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n12-s09/tests/expected.json b/tasks/agg-p08-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1b06c4a76e1ac948e29f08f94e62525c0e4b1399 --- /dev/null +++ b/tasks/agg-p08-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88] diff --git a/tasks/agg-p08-n12-s09/tests/test.sh b/tasks/agg-p08-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n12-s10/instruction.md b/tasks/agg-p08-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..addd22697de677a2c2079817ecf992d0d4b0b0ff --- /dev/null +++ b/tasks/agg-p08-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n12-s10/solution/solve.sh b/tasks/agg-p08-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..07adda3aaa85a93b6f6a866544428fd21f3295c3 --- /dev/null +++ b/tasks/agg-p08-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88]' > "$answer" diff --git a/tasks/agg-p08-n12-s10/task.toml b/tasks/agg-p08-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..93f7093ab4363673c929ff4ddc5dedd201745774 --- /dev/null +++ b/tasks/agg-p08-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n12-s10/tests/expected.json b/tasks/agg-p08-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1b06c4a76e1ac948e29f08f94e62525c0e4b1399 --- /dev/null +++ b/tasks/agg-p08-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88] diff --git a/tasks/agg-p08-n12-s10/tests/test.sh b/tasks/agg-p08-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n12-s11/instruction.md b/tasks/agg-p08-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..55211891d2eae86ad815f2101b3fba33c6a19886 --- /dev/null +++ b/tasks/agg-p08-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n12-s11/solution/solve.sh b/tasks/agg-p08-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..07adda3aaa85a93b6f6a866544428fd21f3295c3 --- /dev/null +++ b/tasks/agg-p08-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88]' > "$answer" diff --git a/tasks/agg-p08-n12-s11/task.toml b/tasks/agg-p08-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..70676b0f1fb0f8837c74f2138ccbb62d727eb941 --- /dev/null +++ b/tasks/agg-p08-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n12-s11/tests/expected.json b/tasks/agg-p08-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1b06c4a76e1ac948e29f08f94e62525c0e4b1399 --- /dev/null +++ b/tasks/agg-p08-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88] diff --git a/tasks/agg-p08-n12-s11/tests/test.sh b/tasks/agg-p08-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n12-s12/instruction.md b/tasks/agg-p08-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..addd22697de677a2c2079817ecf992d0d4b0b0ff --- /dev/null +++ b/tasks/agg-p08-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n12-s12/solution/solve.sh b/tasks/agg-p08-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..07adda3aaa85a93b6f6a866544428fd21f3295c3 --- /dev/null +++ b/tasks/agg-p08-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88]' > "$answer" diff --git a/tasks/agg-p08-n12-s12/task.toml b/tasks/agg-p08-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1938c122f178913ae021022a91c649ae918193da --- /dev/null +++ b/tasks/agg-p08-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p08-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 8 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p08-n12-s12/tests/expected.json b/tasks/agg-p08-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1b06c4a76e1ac948e29f08f94e62525c0e4b1399 --- /dev/null +++ b/tasks/agg-p08-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[24, 35, 37, 44, 56, 66, 68, 70, 70, 71, 76, 88] diff --git a/tasks/agg-p08-n12-s12/tests/test.sh b/tasks/agg-p08-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p08-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p08-n16-s01/instruction.md b/tasks/agg-p08-n16-s01/instruction.md index 10bcc3d169e35738b1fb80abb7316f9cd7c1b230..254a759d5a0113deb55448c366676577f275a1f1 100644 --- a/tasks/agg-p08-n16-s01/instruction.md +++ b/tasks/agg-p08-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s01/tests/test.sh b/tasks/agg-p08-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s01/tests/test.sh +++ b/tasks/agg-p08-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s02/instruction.md b/tasks/agg-p08-n16-s02/instruction.md index 722dd06eb5b0a1781e34a4a84c87448b77da2a59..5e39eb31f3bfe02211382c86f30186b5bbd8d4ba 100644 --- a/tasks/agg-p08-n16-s02/instruction.md +++ b/tasks/agg-p08-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s02/tests/test.sh b/tasks/agg-p08-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s02/tests/test.sh +++ b/tasks/agg-p08-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s03/instruction.md b/tasks/agg-p08-n16-s03/instruction.md index f197f79da6e4638891b46f2053909c167ec13c32..856f7627093ea9ba708f7c4461f757925253fef9 100644 --- a/tasks/agg-p08-n16-s03/instruction.md +++ b/tasks/agg-p08-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s03/tests/test.sh b/tasks/agg-p08-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s03/tests/test.sh +++ b/tasks/agg-p08-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s04/instruction.md b/tasks/agg-p08-n16-s04/instruction.md index a31300409e75190524f2a237c2d0d6348715dc53..106160b98d71014a9eaa408fdaab716f872544a2 100644 --- a/tasks/agg-p08-n16-s04/instruction.md +++ b/tasks/agg-p08-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s04/tests/test.sh b/tasks/agg-p08-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s04/tests/test.sh +++ b/tasks/agg-p08-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s05/instruction.md b/tasks/agg-p08-n16-s05/instruction.md index bec568d59f85e2e30c1eb04f810b7ec136113a04..d047a7120223676abdd7f02b0240a56c724e3fff 100644 --- a/tasks/agg-p08-n16-s05/instruction.md +++ b/tasks/agg-p08-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s05/tests/test.sh b/tasks/agg-p08-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s05/tests/test.sh +++ b/tasks/agg-p08-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s06/instruction.md b/tasks/agg-p08-n16-s06/instruction.md index a7f0266a5e6733a93cf24a409665e6e92f793dba..d4d40f859809c8e8513c129e910f96795729f446 100644 --- a/tasks/agg-p08-n16-s06/instruction.md +++ b/tasks/agg-p08-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s06/tests/test.sh b/tasks/agg-p08-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s06/tests/test.sh +++ b/tasks/agg-p08-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s07/instruction.md b/tasks/agg-p08-n16-s07/instruction.md index 951d8309ecd3f9fbcea5726f506c658fa51c95fe..66045864ad601fbe1194d5fcde0a3bfc9fdbc25b 100644 --- a/tasks/agg-p08-n16-s07/instruction.md +++ b/tasks/agg-p08-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s07/tests/test.sh b/tasks/agg-p08-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s07/tests/test.sh +++ b/tasks/agg-p08-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s08/instruction.md b/tasks/agg-p08-n16-s08/instruction.md index 1fe2576f1a20a278b177c066abc20e44af6a4729..5a9e9eac10d0ea0b9cedb5eefc9f2ace5395d6a9 100644 --- a/tasks/agg-p08-n16-s08/instruction.md +++ b/tasks/agg-p08-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s08/tests/test.sh b/tasks/agg-p08-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s08/tests/test.sh +++ b/tasks/agg-p08-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s09/instruction.md b/tasks/agg-p08-n16-s09/instruction.md index c06c0812a7b7ea5a0caff9ffd07ddd76bc328ac2..769741a0d886c36eda905f6aea67cd579968498f 100644 --- a/tasks/agg-p08-n16-s09/instruction.md +++ b/tasks/agg-p08-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s09/tests/test.sh b/tasks/agg-p08-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s09/tests/test.sh +++ b/tasks/agg-p08-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s10/instruction.md b/tasks/agg-p08-n16-s10/instruction.md index 93b42da3c5ae14f9371e8643b81073fb0536e08a..366c2719a35a34f7a33d98415916d2080eb2b7e2 100644 --- a/tasks/agg-p08-n16-s10/instruction.md +++ b/tasks/agg-p08-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s10/tests/test.sh b/tasks/agg-p08-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s10/tests/test.sh +++ b/tasks/agg-p08-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s11/instruction.md b/tasks/agg-p08-n16-s11/instruction.md index 1fc02ff38c01961e6ef2d04b50e560edacdcca90..1d5113c5dd5abf3bbd4601fe16ab16e11d5a8b7c 100644 --- a/tasks/agg-p08-n16-s11/instruction.md +++ b/tasks/agg-p08-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s11/tests/test.sh b/tasks/agg-p08-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s11/tests/test.sh +++ b/tasks/agg-p08-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s12/instruction.md b/tasks/agg-p08-n16-s12/instruction.md index 93b42da3c5ae14f9371e8643b81073fb0536e08a..366c2719a35a34f7a33d98415916d2080eb2b7e2 100644 --- a/tasks/agg-p08-n16-s12/instruction.md +++ b/tasks/agg-p08-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s12/tests/test.sh b/tasks/agg-p08-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s12/tests/test.sh +++ b/tasks/agg-p08-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s13/instruction.md b/tasks/agg-p08-n16-s13/instruction.md index e2aae6c434553b6621935dc958a71837c92b10ea..d005433b088d7a11d7b322ea605ccb1cdbaff8e5 100644 --- a/tasks/agg-p08-n16-s13/instruction.md +++ b/tasks/agg-p08-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s13/tests/test.sh b/tasks/agg-p08-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s13/tests/test.sh +++ b/tasks/agg-p08-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s14/instruction.md b/tasks/agg-p08-n16-s14/instruction.md index ff35f53eda015951f8078ff0751a783f65818958..e3de5217dbfb10d0002092b53e5f480dfe257ac6 100644 --- a/tasks/agg-p08-n16-s14/instruction.md +++ b/tasks/agg-p08-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s14/tests/test.sh b/tasks/agg-p08-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s14/tests/test.sh +++ b/tasks/agg-p08-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s15/instruction.md b/tasks/agg-p08-n16-s15/instruction.md index 7d5ca093d11da3b866f85566039dbc2ac3bc8c84..7fe87dfffe4ad85e98cdbb07e05a77bf8a912afc 100644 --- a/tasks/agg-p08-n16-s15/instruction.md +++ b/tasks/agg-p08-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s15/tests/test.sh b/tasks/agg-p08-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s15/tests/test.sh +++ b/tasks/agg-p08-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p08-n16-s16/instruction.md b/tasks/agg-p08-n16-s16/instruction.md index 07133633c82ade16a43a26c7ec6cacc19d41b3bd..01eccecf7626f9336ce7f443b7b16b6f87314d4c 100644 --- a/tasks/agg-p08-n16-s16/instruction.md +++ b/tasks/agg-p08-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p08-n16-s16/tests/test.sh b/tasks/agg-p08-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p08-n16-s16/tests/test.sh +++ b/tasks/agg-p08-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n01-s01/instruction.md b/tasks/agg-p09-n01-s01/instruction.md index d0eb215fbe88c75282dd93b86f1247f5258aeca5..8c96828a8007e87f9f27a9b660371c74fb62feb6 100644 --- a/tasks/agg-p09-n01-s01/instruction.md +++ b/tasks/agg-p09-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is forty. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p09-n01-s01/tests/test.sh b/tasks/agg-p09-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n01-s01/tests/test.sh +++ b/tasks/agg-p09-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n02-s01/instruction.md b/tasks/agg-p09-n02-s01/instruction.md index 393e555ec1d2b25cc4eef73d76af3df0ebc9f6ce..bd4b65325dd032135e1b13aa4a351d44469aeb29 100644 --- a/tasks/agg-p09-n02-s01/instruction.md +++ b/tasks/agg-p09-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n02-s01/tests/test.sh b/tasks/agg-p09-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n02-s01/tests/test.sh +++ b/tasks/agg-p09-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n02-s02/instruction.md b/tasks/agg-p09-n02-s02/instruction.md index d53c8d394422ff6fb45411356dd9784f0bd9e9f1..0fe4a78b6c4a02b372358b55f48c9c8a0f564273 100644 --- a/tasks/agg-p09-n02-s02/instruction.md +++ b/tasks/agg-p09-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n02-s02/tests/test.sh b/tasks/agg-p09-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n02-s02/tests/test.sh +++ b/tasks/agg-p09-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n04-s01/instruction.md b/tasks/agg-p09-n04-s01/instruction.md index 525b5a36580eb1d89ffda210a1193456cab19921..cb3a599841979a590b9dc6c125d562ddc1e49fab 100644 --- a/tasks/agg-p09-n04-s01/instruction.md +++ b/tasks/agg-p09-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n04-s01/tests/test.sh b/tasks/agg-p09-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n04-s01/tests/test.sh +++ b/tasks/agg-p09-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n04-s02/instruction.md b/tasks/agg-p09-n04-s02/instruction.md index ef36ba153f10efe5727ee31abce38b8dd6141aca..e95b7b28395f0be68043d868e45036c0708293fe 100644 --- a/tasks/agg-p09-n04-s02/instruction.md +++ b/tasks/agg-p09-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n04-s02/tests/test.sh b/tasks/agg-p09-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n04-s02/tests/test.sh +++ b/tasks/agg-p09-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n04-s03/instruction.md b/tasks/agg-p09-n04-s03/instruction.md index 10ac8a4eaab16f5c9d5a059aa13a56223f70be52..580537b716862c0c2a25f5061693e8c4ccbd726a 100644 --- a/tasks/agg-p09-n04-s03/instruction.md +++ b/tasks/agg-p09-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n04-s03/tests/test.sh b/tasks/agg-p09-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n04-s03/tests/test.sh +++ b/tasks/agg-p09-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n04-s04/instruction.md b/tasks/agg-p09-n04-s04/instruction.md index 213f8f76a9f8395afe0c544ecd0e256b5d3a221a..2e3ad263c637a04b51ce9884664e8f02e6f0771c 100644 --- a/tasks/agg-p09-n04-s04/instruction.md +++ b/tasks/agg-p09-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n04-s04/tests/test.sh b/tasks/agg-p09-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n04-s04/tests/test.sh +++ b/tasks/agg-p09-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n06-s01/instruction.md b/tasks/agg-p09-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a85f12b18f520ed02306f7601d3daf87529d5788 --- /dev/null +++ b/tasks/agg-p09-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n06-s01/solution/solve.sh b/tasks/agg-p09-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..db1b8dcd95a8d6efa28761f46ec6ef336c919aa8 --- /dev/null +++ b/tasks/agg-p09-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[40, 43, 60, 65, 66, 67]' > "$answer" diff --git a/tasks/agg-p09-n06-s01/task.toml b/tasks/agg-p09-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..50caa3a51305c63253228256e1171983bb34d731 --- /dev/null +++ b/tasks/agg-p09-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n06-s01/tests/expected.json b/tasks/agg-p09-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ff7d6a9e0bd28dd8323b9f07b825211fe137818 --- /dev/null +++ b/tasks/agg-p09-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[40, 43, 60, 65, 66, 67] diff --git a/tasks/agg-p09-n06-s01/tests/test.sh b/tasks/agg-p09-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n06-s02/instruction.md b/tasks/agg-p09-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8cccd6bb4840d122bc891dcbcfc377ca88a66413 --- /dev/null +++ b/tasks/agg-p09-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n06-s02/solution/solve.sh b/tasks/agg-p09-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..db1b8dcd95a8d6efa28761f46ec6ef336c919aa8 --- /dev/null +++ b/tasks/agg-p09-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[40, 43, 60, 65, 66, 67]' > "$answer" diff --git a/tasks/agg-p09-n06-s02/task.toml b/tasks/agg-p09-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2658ebbffedcb48ceb9e175946d601a1afdc1d31 --- /dev/null +++ b/tasks/agg-p09-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n06-s02/tests/expected.json b/tasks/agg-p09-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ff7d6a9e0bd28dd8323b9f07b825211fe137818 --- /dev/null +++ b/tasks/agg-p09-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[40, 43, 60, 65, 66, 67] diff --git a/tasks/agg-p09-n06-s02/tests/test.sh b/tasks/agg-p09-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n06-s03/instruction.md b/tasks/agg-p09-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..87a186de4613802ff07f90a3ea674bd2076057bc --- /dev/null +++ b/tasks/agg-p09-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n06-s03/solution/solve.sh b/tasks/agg-p09-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..db1b8dcd95a8d6efa28761f46ec6ef336c919aa8 --- /dev/null +++ b/tasks/agg-p09-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[40, 43, 60, 65, 66, 67]' > "$answer" diff --git a/tasks/agg-p09-n06-s03/task.toml b/tasks/agg-p09-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3fda1184f554557abb8982038a0bc3ff3400a829 --- /dev/null +++ b/tasks/agg-p09-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n06-s03/tests/expected.json b/tasks/agg-p09-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ff7d6a9e0bd28dd8323b9f07b825211fe137818 --- /dev/null +++ b/tasks/agg-p09-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[40, 43, 60, 65, 66, 67] diff --git a/tasks/agg-p09-n06-s03/tests/test.sh b/tasks/agg-p09-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n06-s04/instruction.md b/tasks/agg-p09-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bc2345670eef592df5089b3576aa387d4b4f7ef0 --- /dev/null +++ b/tasks/agg-p09-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n06-s04/solution/solve.sh b/tasks/agg-p09-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..db1b8dcd95a8d6efa28761f46ec6ef336c919aa8 --- /dev/null +++ b/tasks/agg-p09-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[40, 43, 60, 65, 66, 67]' > "$answer" diff --git a/tasks/agg-p09-n06-s04/task.toml b/tasks/agg-p09-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d336bed6d25684655b969ae7975fd0beea334e9a --- /dev/null +++ b/tasks/agg-p09-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n06-s04/tests/expected.json b/tasks/agg-p09-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ff7d6a9e0bd28dd8323b9f07b825211fe137818 --- /dev/null +++ b/tasks/agg-p09-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[40, 43, 60, 65, 66, 67] diff --git a/tasks/agg-p09-n06-s04/tests/test.sh b/tasks/agg-p09-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n06-s05/instruction.md b/tasks/agg-p09-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1abb1884fa9c9ca8da74a51b5102c8ab1b567c30 --- /dev/null +++ b/tasks/agg-p09-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n06-s05/solution/solve.sh b/tasks/agg-p09-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..db1b8dcd95a8d6efa28761f46ec6ef336c919aa8 --- /dev/null +++ b/tasks/agg-p09-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[40, 43, 60, 65, 66, 67]' > "$answer" diff --git a/tasks/agg-p09-n06-s05/task.toml b/tasks/agg-p09-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5ee0b47aeefc62cd7a0b222bb94021dcc4ed0983 --- /dev/null +++ b/tasks/agg-p09-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n06-s05/tests/expected.json b/tasks/agg-p09-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ff7d6a9e0bd28dd8323b9f07b825211fe137818 --- /dev/null +++ b/tasks/agg-p09-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[40, 43, 60, 65, 66, 67] diff --git a/tasks/agg-p09-n06-s05/tests/test.sh b/tasks/agg-p09-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n06-s06/instruction.md b/tasks/agg-p09-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b852d926c8b9ec17901e2d02456a03cfa3f7bf78 --- /dev/null +++ b/tasks/agg-p09-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n06-s06/solution/solve.sh b/tasks/agg-p09-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..db1b8dcd95a8d6efa28761f46ec6ef336c919aa8 --- /dev/null +++ b/tasks/agg-p09-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[40, 43, 60, 65, 66, 67]' > "$answer" diff --git a/tasks/agg-p09-n06-s06/task.toml b/tasks/agg-p09-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2f161d8a9ef70ed8497ccc054ac554a444cc9524 --- /dev/null +++ b/tasks/agg-p09-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n06-s06/tests/expected.json b/tasks/agg-p09-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ff7d6a9e0bd28dd8323b9f07b825211fe137818 --- /dev/null +++ b/tasks/agg-p09-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[40, 43, 60, 65, 66, 67] diff --git a/tasks/agg-p09-n06-s06/tests/test.sh b/tasks/agg-p09-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n08-s01/instruction.md b/tasks/agg-p09-n08-s01/instruction.md index d7293023b756e96b4a6f07b0a65c2cc3406ac4be..bdf5bdd40bc567aa9d5da83763d074be44e853b3 100644 --- a/tasks/agg-p09-n08-s01/instruction.md +++ b/tasks/agg-p09-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n08-s01/tests/test.sh b/tasks/agg-p09-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n08-s01/tests/test.sh +++ b/tasks/agg-p09-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n08-s02/instruction.md b/tasks/agg-p09-n08-s02/instruction.md index c462ac9ca802050bd457b3cfba5d7a79b08da47d..8e802c76e52f1cd50ead7780f6b45504832c0a85 100644 --- a/tasks/agg-p09-n08-s02/instruction.md +++ b/tasks/agg-p09-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n08-s02/tests/test.sh b/tasks/agg-p09-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n08-s02/tests/test.sh +++ b/tasks/agg-p09-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n08-s03/instruction.md b/tasks/agg-p09-n08-s03/instruction.md index e5a9078e4c58d734bc89d35a1a10f88352728538..39e243af8207cc8b7adc554fc5ac12d75cb1895b 100644 --- a/tasks/agg-p09-n08-s03/instruction.md +++ b/tasks/agg-p09-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n08-s03/tests/test.sh b/tasks/agg-p09-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n08-s03/tests/test.sh +++ b/tasks/agg-p09-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n08-s04/instruction.md b/tasks/agg-p09-n08-s04/instruction.md index 2c724ce2f54c8829b6d803659e7e96973259720e..162682e2e51553326a61ee7f19eafb58e7dcde79 100644 --- a/tasks/agg-p09-n08-s04/instruction.md +++ b/tasks/agg-p09-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n08-s04/tests/test.sh b/tasks/agg-p09-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n08-s04/tests/test.sh +++ b/tasks/agg-p09-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n08-s05/instruction.md b/tasks/agg-p09-n08-s05/instruction.md index 89eac19a8c558e6f60ddcf74c895a44ee106e0a6..f5b6dc9249d992d70694345e0d01c15668ee6807 100644 --- a/tasks/agg-p09-n08-s05/instruction.md +++ b/tasks/agg-p09-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n08-s05/tests/test.sh b/tasks/agg-p09-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n08-s05/tests/test.sh +++ b/tasks/agg-p09-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n08-s06/instruction.md b/tasks/agg-p09-n08-s06/instruction.md index ec71f13b5946962c63788849abcae6208cb70629..ef1dffc1dcd1591d345fdae84de25e3aec26953a 100644 --- a/tasks/agg-p09-n08-s06/instruction.md +++ b/tasks/agg-p09-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n08-s06/tests/test.sh b/tasks/agg-p09-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n08-s06/tests/test.sh +++ b/tasks/agg-p09-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n08-s07/instruction.md b/tasks/agg-p09-n08-s07/instruction.md index 54d881d3c1889509c322ddf6355b6cd34a504304..6f6241871bd4db6009f6523f0ed2321a59f5ed3f 100644 --- a/tasks/agg-p09-n08-s07/instruction.md +++ b/tasks/agg-p09-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n08-s07/tests/test.sh b/tasks/agg-p09-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n08-s07/tests/test.sh +++ b/tasks/agg-p09-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n08-s08/instruction.md b/tasks/agg-p09-n08-s08/instruction.md index 6c99d3a421a7820e0d5105d7dbdbfe39b5c15b23..eac777563a00a423c4b9e27422d5202e95928f87 100644 --- a/tasks/agg-p09-n08-s08/instruction.md +++ b/tasks/agg-p09-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n08-s08/tests/test.sh b/tasks/agg-p09-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n08-s08/tests/test.sh +++ b/tasks/agg-p09-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n12-s01/instruction.md b/tasks/agg-p09-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..38af6f0bdb6b176fabb077ede4dd67eef822da02 --- /dev/null +++ b/tasks/agg-p09-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n12-s01/solution/solve.sh b/tasks/agg-p09-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bf4d7ea7f0fe72be78a4ae8e4580f11094a8d76 --- /dev/null +++ b/tasks/agg-p09-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88]' > "$answer" diff --git a/tasks/agg-p09-n12-s01/task.toml b/tasks/agg-p09-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..740376fd12115d7752e0fa140ae194e4c9997884 --- /dev/null +++ b/tasks/agg-p09-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n12-s01/tests/expected.json b/tasks/agg-p09-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..5213c77b330c5713cc56b36340bc0062348130be --- /dev/null +++ b/tasks/agg-p09-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88] diff --git a/tasks/agg-p09-n12-s01/tests/test.sh b/tasks/agg-p09-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n12-s02/instruction.md b/tasks/agg-p09-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ac0fb3589d74cb9ec090d7919df303360b87a4cd --- /dev/null +++ b/tasks/agg-p09-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n12-s02/solution/solve.sh b/tasks/agg-p09-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bf4d7ea7f0fe72be78a4ae8e4580f11094a8d76 --- /dev/null +++ b/tasks/agg-p09-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88]' > "$answer" diff --git a/tasks/agg-p09-n12-s02/task.toml b/tasks/agg-p09-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8c224ddae666d43b89c6bf24ff068d007dbe51eb --- /dev/null +++ b/tasks/agg-p09-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n12-s02/tests/expected.json b/tasks/agg-p09-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..5213c77b330c5713cc56b36340bc0062348130be --- /dev/null +++ b/tasks/agg-p09-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88] diff --git a/tasks/agg-p09-n12-s02/tests/test.sh b/tasks/agg-p09-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n12-s03/instruction.md b/tasks/agg-p09-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9d09fce34dd764ef615193ac1a5121b1d8ac297a --- /dev/null +++ b/tasks/agg-p09-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n12-s03/solution/solve.sh b/tasks/agg-p09-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bf4d7ea7f0fe72be78a4ae8e4580f11094a8d76 --- /dev/null +++ b/tasks/agg-p09-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88]' > "$answer" diff --git a/tasks/agg-p09-n12-s03/task.toml b/tasks/agg-p09-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e3375e677f05d9fa1c77508b7dae6584578be8ff --- /dev/null +++ b/tasks/agg-p09-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n12-s03/tests/expected.json b/tasks/agg-p09-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..5213c77b330c5713cc56b36340bc0062348130be --- /dev/null +++ b/tasks/agg-p09-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88] diff --git a/tasks/agg-p09-n12-s03/tests/test.sh b/tasks/agg-p09-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n12-s04/instruction.md b/tasks/agg-p09-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..894c08d452dd150a471307a3b982c78b62f7152f --- /dev/null +++ b/tasks/agg-p09-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n12-s04/solution/solve.sh b/tasks/agg-p09-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bf4d7ea7f0fe72be78a4ae8e4580f11094a8d76 --- /dev/null +++ b/tasks/agg-p09-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88]' > "$answer" diff --git a/tasks/agg-p09-n12-s04/task.toml b/tasks/agg-p09-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6b024c889fdd3a8e76369839215e46d55ff6d83d --- /dev/null +++ b/tasks/agg-p09-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n12-s04/tests/expected.json b/tasks/agg-p09-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..5213c77b330c5713cc56b36340bc0062348130be --- /dev/null +++ b/tasks/agg-p09-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88] diff --git a/tasks/agg-p09-n12-s04/tests/test.sh b/tasks/agg-p09-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n12-s05/instruction.md b/tasks/agg-p09-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ff37839de603bed81e1ff4cb6e5bbc82255f953f --- /dev/null +++ b/tasks/agg-p09-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n12-s05/solution/solve.sh b/tasks/agg-p09-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bf4d7ea7f0fe72be78a4ae8e4580f11094a8d76 --- /dev/null +++ b/tasks/agg-p09-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88]' > "$answer" diff --git a/tasks/agg-p09-n12-s05/task.toml b/tasks/agg-p09-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d70fd9144981773b6ae27afe8a4e93fb0b7a65d1 --- /dev/null +++ b/tasks/agg-p09-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n12-s05/tests/expected.json b/tasks/agg-p09-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..5213c77b330c5713cc56b36340bc0062348130be --- /dev/null +++ b/tasks/agg-p09-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88] diff --git a/tasks/agg-p09-n12-s05/tests/test.sh b/tasks/agg-p09-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n12-s06/instruction.md b/tasks/agg-p09-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6e844f7a3e8d345b3d28255a1eef90feb406b747 --- /dev/null +++ b/tasks/agg-p09-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n12-s06/solution/solve.sh b/tasks/agg-p09-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bf4d7ea7f0fe72be78a4ae8e4580f11094a8d76 --- /dev/null +++ b/tasks/agg-p09-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88]' > "$answer" diff --git a/tasks/agg-p09-n12-s06/task.toml b/tasks/agg-p09-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..59a5f0380680e1b2285ce2928299d7b3314ec98f --- /dev/null +++ b/tasks/agg-p09-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n12-s06/tests/expected.json b/tasks/agg-p09-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..5213c77b330c5713cc56b36340bc0062348130be --- /dev/null +++ b/tasks/agg-p09-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88] diff --git a/tasks/agg-p09-n12-s06/tests/test.sh b/tasks/agg-p09-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n12-s07/instruction.md b/tasks/agg-p09-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1bb8f11690672412ad07a665fbb7f3d7d2ab1336 --- /dev/null +++ b/tasks/agg-p09-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fourteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n12-s07/solution/solve.sh b/tasks/agg-p09-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bf4d7ea7f0fe72be78a4ae8e4580f11094a8d76 --- /dev/null +++ b/tasks/agg-p09-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88]' > "$answer" diff --git a/tasks/agg-p09-n12-s07/task.toml b/tasks/agg-p09-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..31ede9516d5cf858265d3d150f54ecfb458663e2 --- /dev/null +++ b/tasks/agg-p09-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n12-s07/tests/expected.json b/tasks/agg-p09-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..5213c77b330c5713cc56b36340bc0062348130be --- /dev/null +++ b/tasks/agg-p09-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88] diff --git a/tasks/agg-p09-n12-s07/tests/test.sh b/tasks/agg-p09-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n12-s08/instruction.md b/tasks/agg-p09-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bc6ecc07cf5acdcd085bd56b2102f26cc68f534e --- /dev/null +++ b/tasks/agg-p09-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n12-s08/solution/solve.sh b/tasks/agg-p09-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bf4d7ea7f0fe72be78a4ae8e4580f11094a8d76 --- /dev/null +++ b/tasks/agg-p09-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88]' > "$answer" diff --git a/tasks/agg-p09-n12-s08/task.toml b/tasks/agg-p09-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..836f9cd7f491b7bb91c1ffff5b10b1f63ca7ed78 --- /dev/null +++ b/tasks/agg-p09-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n12-s08/tests/expected.json b/tasks/agg-p09-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..5213c77b330c5713cc56b36340bc0062348130be --- /dev/null +++ b/tasks/agg-p09-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88] diff --git a/tasks/agg-p09-n12-s08/tests/test.sh b/tasks/agg-p09-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n12-s09/instruction.md b/tasks/agg-p09-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ca689d19db465172c22b2b5dc9acaa4689858529 --- /dev/null +++ b/tasks/agg-p09-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n12-s09/solution/solve.sh b/tasks/agg-p09-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bf4d7ea7f0fe72be78a4ae8e4580f11094a8d76 --- /dev/null +++ b/tasks/agg-p09-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88]' > "$answer" diff --git a/tasks/agg-p09-n12-s09/task.toml b/tasks/agg-p09-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4edd065f5256c50b8b1f3a543e030e6a123237ed --- /dev/null +++ b/tasks/agg-p09-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n12-s09/tests/expected.json b/tasks/agg-p09-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..5213c77b330c5713cc56b36340bc0062348130be --- /dev/null +++ b/tasks/agg-p09-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88] diff --git a/tasks/agg-p09-n12-s09/tests/test.sh b/tasks/agg-p09-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n12-s10/instruction.md b/tasks/agg-p09-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..83c5f678c22dac3906bb709f049b6407e3c59614 --- /dev/null +++ b/tasks/agg-p09-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n12-s10/solution/solve.sh b/tasks/agg-p09-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bf4d7ea7f0fe72be78a4ae8e4580f11094a8d76 --- /dev/null +++ b/tasks/agg-p09-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88]' > "$answer" diff --git a/tasks/agg-p09-n12-s10/task.toml b/tasks/agg-p09-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a984499f817e6334938474133426e8e7fa360a51 --- /dev/null +++ b/tasks/agg-p09-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n12-s10/tests/expected.json b/tasks/agg-p09-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..5213c77b330c5713cc56b36340bc0062348130be --- /dev/null +++ b/tasks/agg-p09-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88] diff --git a/tasks/agg-p09-n12-s10/tests/test.sh b/tasks/agg-p09-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n12-s11/instruction.md b/tasks/agg-p09-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7201ad16b41f6e2d149e2c45df4bcd774a258af1 --- /dev/null +++ b/tasks/agg-p09-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n12-s11/solution/solve.sh b/tasks/agg-p09-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bf4d7ea7f0fe72be78a4ae8e4580f11094a8d76 --- /dev/null +++ b/tasks/agg-p09-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88]' > "$answer" diff --git a/tasks/agg-p09-n12-s11/task.toml b/tasks/agg-p09-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..72c17d3d3cf8054cdcb4bf173a0c30cb5c00845b --- /dev/null +++ b/tasks/agg-p09-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n12-s11/tests/expected.json b/tasks/agg-p09-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..5213c77b330c5713cc56b36340bc0062348130be --- /dev/null +++ b/tasks/agg-p09-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88] diff --git a/tasks/agg-p09-n12-s11/tests/test.sh b/tasks/agg-p09-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n12-s12/instruction.md b/tasks/agg-p09-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cceebebec44b442f3530d40bdabf89079a1da1a4 --- /dev/null +++ b/tasks/agg-p09-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n12-s12/solution/solve.sh b/tasks/agg-p09-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bf4d7ea7f0fe72be78a4ae8e4580f11094a8d76 --- /dev/null +++ b/tasks/agg-p09-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88]' > "$answer" diff --git a/tasks/agg-p09-n12-s12/task.toml b/tasks/agg-p09-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7972ff4be6f0e29c60a0abf8d153b955b665eb3e --- /dev/null +++ b/tasks/agg-p09-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p09-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 9 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p09-n12-s12/tests/expected.json b/tasks/agg-p09-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..5213c77b330c5713cc56b36340bc0062348130be --- /dev/null +++ b/tasks/agg-p09-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[8, 14, 18, 20, 40, 43, 60, 65, 66, 67, 81, 88] diff --git a/tasks/agg-p09-n12-s12/tests/test.sh b/tasks/agg-p09-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p09-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p09-n16-s01/instruction.md b/tasks/agg-p09-n16-s01/instruction.md index ebe30196b058cfe81ab8a53dd5461649bcf91202..7078e28d54452ae1cab8849d4648225bf8c92be9 100644 --- a/tasks/agg-p09-n16-s01/instruction.md +++ b/tasks/agg-p09-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s01/tests/test.sh b/tasks/agg-p09-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s01/tests/test.sh +++ b/tasks/agg-p09-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s02/instruction.md b/tasks/agg-p09-n16-s02/instruction.md index cebfaeb748131e1409dea8040dd71bd8744f230b..f855e374529122b9a74995c685bdc0845b660076 100644 --- a/tasks/agg-p09-n16-s02/instruction.md +++ b/tasks/agg-p09-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s02/tests/test.sh b/tasks/agg-p09-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s02/tests/test.sh +++ b/tasks/agg-p09-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s03/instruction.md b/tasks/agg-p09-n16-s03/instruction.md index c9f61576dcb8ea2769bc6b953c327b5baba2bb54..728715ff5a180904d17bdd4c6d3921ea7a2eb170 100644 --- a/tasks/agg-p09-n16-s03/instruction.md +++ b/tasks/agg-p09-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s03/tests/test.sh b/tasks/agg-p09-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s03/tests/test.sh +++ b/tasks/agg-p09-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s04/instruction.md b/tasks/agg-p09-n16-s04/instruction.md index c0f9d178a1c3057c8c4b57e9c5eca4e4c625b138..efa987bc861271d3fcd4cc6f1530e4d2ecbb6990 100644 --- a/tasks/agg-p09-n16-s04/instruction.md +++ b/tasks/agg-p09-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s04/tests/test.sh b/tasks/agg-p09-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s04/tests/test.sh +++ b/tasks/agg-p09-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s05/instruction.md b/tasks/agg-p09-n16-s05/instruction.md index 0d32baca836c92adef8d08189e020f30d37446a4..acf1e48e00457882cd30e3ee2f445009de15d69b 100644 --- a/tasks/agg-p09-n16-s05/instruction.md +++ b/tasks/agg-p09-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s05/tests/test.sh b/tasks/agg-p09-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s05/tests/test.sh +++ b/tasks/agg-p09-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s06/instruction.md b/tasks/agg-p09-n16-s06/instruction.md index bec568d59f85e2e30c1eb04f810b7ec136113a04..d047a7120223676abdd7f02b0240a56c724e3fff 100644 --- a/tasks/agg-p09-n16-s06/instruction.md +++ b/tasks/agg-p09-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s06/tests/test.sh b/tasks/agg-p09-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s06/tests/test.sh +++ b/tasks/agg-p09-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s07/instruction.md b/tasks/agg-p09-n16-s07/instruction.md index 63a1a563a0b3abdd4e128d86f97d0a2fb0ea5c9e..7bc3e049121a5282217af4b5cf2ab2b62234a6ec 100644 --- a/tasks/agg-p09-n16-s07/instruction.md +++ b/tasks/agg-p09-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s07/tests/test.sh b/tasks/agg-p09-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s07/tests/test.sh +++ b/tasks/agg-p09-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s08/instruction.md b/tasks/agg-p09-n16-s08/instruction.md index 57c62f85ec1ef4f9ca9aa899d016621c4b04432a..e1bd267ed9ac9c4fbf94870756f771be1265779a 100644 --- a/tasks/agg-p09-n16-s08/instruction.md +++ b/tasks/agg-p09-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s08/tests/test.sh b/tasks/agg-p09-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s08/tests/test.sh +++ b/tasks/agg-p09-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s09/instruction.md b/tasks/agg-p09-n16-s09/instruction.md index f197f79da6e4638891b46f2053909c167ec13c32..856f7627093ea9ba708f7c4461f757925253fef9 100644 --- a/tasks/agg-p09-n16-s09/instruction.md +++ b/tasks/agg-p09-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s09/tests/test.sh b/tasks/agg-p09-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s09/tests/test.sh +++ b/tasks/agg-p09-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s10/instruction.md b/tasks/agg-p09-n16-s10/instruction.md index be22dd060dc917313859b782fc59371588c6eefe..1ae1c83f6310b28c94d56fb3f9788827f371c4c2 100644 --- a/tasks/agg-p09-n16-s10/instruction.md +++ b/tasks/agg-p09-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s10/tests/test.sh b/tasks/agg-p09-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s10/tests/test.sh +++ b/tasks/agg-p09-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s11/instruction.md b/tasks/agg-p09-n16-s11/instruction.md index 99a7f97eb2774bf91fcf02fc9e18c71f2c746d9d..b0c86232070beace6f6b66df51114731c8869870 100644 --- a/tasks/agg-p09-n16-s11/instruction.md +++ b/tasks/agg-p09-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s11/tests/test.sh b/tasks/agg-p09-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s11/tests/test.sh +++ b/tasks/agg-p09-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s12/instruction.md b/tasks/agg-p09-n16-s12/instruction.md index 81577d14ed82fb21b17e0bd51c9dc2a594f0c1b6..02d90432252450a09c7a989f19e252e75078b8f6 100644 --- a/tasks/agg-p09-n16-s12/instruction.md +++ b/tasks/agg-p09-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s12/tests/test.sh b/tasks/agg-p09-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s12/tests/test.sh +++ b/tasks/agg-p09-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s13/instruction.md b/tasks/agg-p09-n16-s13/instruction.md index 63a1a563a0b3abdd4e128d86f97d0a2fb0ea5c9e..7bc3e049121a5282217af4b5cf2ab2b62234a6ec 100644 --- a/tasks/agg-p09-n16-s13/instruction.md +++ b/tasks/agg-p09-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s13/tests/test.sh b/tasks/agg-p09-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s13/tests/test.sh +++ b/tasks/agg-p09-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s14/instruction.md b/tasks/agg-p09-n16-s14/instruction.md index a7f0266a5e6733a93cf24a409665e6e92f793dba..d4d40f859809c8e8513c129e910f96795729f446 100644 --- a/tasks/agg-p09-n16-s14/instruction.md +++ b/tasks/agg-p09-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s14/tests/test.sh b/tasks/agg-p09-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s14/tests/test.sh +++ b/tasks/agg-p09-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s15/instruction.md b/tasks/agg-p09-n16-s15/instruction.md index 1245386f0aba38aec1627364e9a0bdce0b3a3214..7a6abd7e671d0d5e514cf3a081a12822f3e1fa80 100644 --- a/tasks/agg-p09-n16-s15/instruction.md +++ b/tasks/agg-p09-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s15/tests/test.sh b/tasks/agg-p09-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s15/tests/test.sh +++ b/tasks/agg-p09-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p09-n16-s16/instruction.md b/tasks/agg-p09-n16-s16/instruction.md index eec0889f35f181e3d5ee370338313f8afc894fe8..741d5c897d7dc6413c1bb96a8b00478c60c908ba 100644 --- a/tasks/agg-p09-n16-s16/instruction.md +++ b/tasks/agg-p09-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p09-n16-s16/tests/test.sh b/tasks/agg-p09-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p09-n16-s16/tests/test.sh +++ b/tasks/agg-p09-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n01-s01/instruction.md b/tasks/agg-p10-n01-s01/instruction.md index 61a677bc713271fcb389d5ec83159ad60800bad7..46144dcf3a44dff0b79f9e3926e182a7509b2418 100644 --- a/tasks/agg-p10-n01-s01/instruction.md +++ b/tasks/agg-p10-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is sixty-nine. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p10-n01-s01/tests/test.sh b/tasks/agg-p10-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n01-s01/tests/test.sh +++ b/tasks/agg-p10-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n02-s01/instruction.md b/tasks/agg-p10-n02-s01/instruction.md index d1ab0be669f794edef44ee658c7897d122e5e269..203f6294ff67901ed985d7bbb78cffd236c49d4f 100644 --- a/tasks/agg-p10-n02-s01/instruction.md +++ b/tasks/agg-p10-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n02-s01/tests/test.sh b/tasks/agg-p10-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n02-s01/tests/test.sh +++ b/tasks/agg-p10-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n02-s02/instruction.md b/tasks/agg-p10-n02-s02/instruction.md index c0a22bf07723c6b02eaae61a48922ea7f58129c4..9502fbbe1a4a14cd22c1f59c86d207ae1c5ac40c 100644 --- a/tasks/agg-p10-n02-s02/instruction.md +++ b/tasks/agg-p10-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n02-s02/tests/test.sh b/tasks/agg-p10-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n02-s02/tests/test.sh +++ b/tasks/agg-p10-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n04-s01/instruction.md b/tasks/agg-p10-n04-s01/instruction.md index 189ef04e2f40301a08ddef437dba11e2c4d3907a..fd7c3cf4ddc29ed0b8aeb3aa0b4ffd3b2fea0ec5 100644 --- a/tasks/agg-p10-n04-s01/instruction.md +++ b/tasks/agg-p10-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n04-s01/tests/test.sh b/tasks/agg-p10-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n04-s01/tests/test.sh +++ b/tasks/agg-p10-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n04-s02/instruction.md b/tasks/agg-p10-n04-s02/instruction.md index 00f783bdbb5bc769d650beb27a56e90f047df0cf..982344aa946f9e9135f86cdd8c758339f20e57da 100644 --- a/tasks/agg-p10-n04-s02/instruction.md +++ b/tasks/agg-p10-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n04-s02/tests/test.sh b/tasks/agg-p10-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n04-s02/tests/test.sh +++ b/tasks/agg-p10-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n04-s03/instruction.md b/tasks/agg-p10-n04-s03/instruction.md index 8229ec32a8706beb71697adddf42a1fc48ee812a..0cce0cc72b847f422e9282a2d3dd61a1916d9953 100644 --- a/tasks/agg-p10-n04-s03/instruction.md +++ b/tasks/agg-p10-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n04-s03/tests/test.sh b/tasks/agg-p10-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n04-s03/tests/test.sh +++ b/tasks/agg-p10-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n04-s04/instruction.md b/tasks/agg-p10-n04-s04/instruction.md index 443e407657e73595d97fcfe569c9474712df94c6..dc553c9c6f293e57dbc034e45d381265cb22e253 100644 --- a/tasks/agg-p10-n04-s04/instruction.md +++ b/tasks/agg-p10-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n04-s04/tests/test.sh b/tasks/agg-p10-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n04-s04/tests/test.sh +++ b/tasks/agg-p10-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n06-s01/instruction.md b/tasks/agg-p10-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1ae5701228c0785276a3840ea6979f720367dde7 --- /dev/null +++ b/tasks/agg-p10-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n06-s01/solution/solve.sh b/tasks/agg-p10-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..19cdf06423737da10ac10c8538e282b90dbff536 --- /dev/null +++ b/tasks/agg-p10-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 12, 19, 51, 69, 79]' > "$answer" diff --git a/tasks/agg-p10-n06-s01/task.toml b/tasks/agg-p10-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9f9f4f563e4f081a90b4b8a6aea7c61db3b296cd --- /dev/null +++ b/tasks/agg-p10-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n06-s01/tests/expected.json b/tasks/agg-p10-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e8a431f5783d88a5817930ee9515aeffa780f337 --- /dev/null +++ b/tasks/agg-p10-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[5, 12, 19, 51, 69, 79] diff --git a/tasks/agg-p10-n06-s01/tests/test.sh b/tasks/agg-p10-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n06-s02/instruction.md b/tasks/agg-p10-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..16ce88e278c54743f1986a3fcb6cf261130fd7ec --- /dev/null +++ b/tasks/agg-p10-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n06-s02/solution/solve.sh b/tasks/agg-p10-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..19cdf06423737da10ac10c8538e282b90dbff536 --- /dev/null +++ b/tasks/agg-p10-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 12, 19, 51, 69, 79]' > "$answer" diff --git a/tasks/agg-p10-n06-s02/task.toml b/tasks/agg-p10-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1208960b15d3617166b970382660fe2293506692 --- /dev/null +++ b/tasks/agg-p10-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n06-s02/tests/expected.json b/tasks/agg-p10-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e8a431f5783d88a5817930ee9515aeffa780f337 --- /dev/null +++ b/tasks/agg-p10-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[5, 12, 19, 51, 69, 79] diff --git a/tasks/agg-p10-n06-s02/tests/test.sh b/tasks/agg-p10-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n06-s03/instruction.md b/tasks/agg-p10-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a3162e0c3af58aba4c255d22f35fe5415203df89 --- /dev/null +++ b/tasks/agg-p10-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is nineteen. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n06-s03/solution/solve.sh b/tasks/agg-p10-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..19cdf06423737da10ac10c8538e282b90dbff536 --- /dev/null +++ b/tasks/agg-p10-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 12, 19, 51, 69, 79]' > "$answer" diff --git a/tasks/agg-p10-n06-s03/task.toml b/tasks/agg-p10-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..362cb785a130cc49fb3f0d8e5062f4ba6a1e3252 --- /dev/null +++ b/tasks/agg-p10-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n06-s03/tests/expected.json b/tasks/agg-p10-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e8a431f5783d88a5817930ee9515aeffa780f337 --- /dev/null +++ b/tasks/agg-p10-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[5, 12, 19, 51, 69, 79] diff --git a/tasks/agg-p10-n06-s03/tests/test.sh b/tasks/agg-p10-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n06-s04/instruction.md b/tasks/agg-p10-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..64ac36448e2dbf7956db9f18492ddc2ab2e6610f --- /dev/null +++ b/tasks/agg-p10-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twelve. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n06-s04/solution/solve.sh b/tasks/agg-p10-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..19cdf06423737da10ac10c8538e282b90dbff536 --- /dev/null +++ b/tasks/agg-p10-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 12, 19, 51, 69, 79]' > "$answer" diff --git a/tasks/agg-p10-n06-s04/task.toml b/tasks/agg-p10-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..83ff5df96a99a706144397c5f8ec1d5f745bf065 --- /dev/null +++ b/tasks/agg-p10-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n06-s04/tests/expected.json b/tasks/agg-p10-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e8a431f5783d88a5817930ee9515aeffa780f337 --- /dev/null +++ b/tasks/agg-p10-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[5, 12, 19, 51, 69, 79] diff --git a/tasks/agg-p10-n06-s04/tests/test.sh b/tasks/agg-p10-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n06-s05/instruction.md b/tasks/agg-p10-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..69d7d5fa36cbcf249bb2f709999ee0ae1aba7eca --- /dev/null +++ b/tasks/agg-p10-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n06-s05/solution/solve.sh b/tasks/agg-p10-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..19cdf06423737da10ac10c8538e282b90dbff536 --- /dev/null +++ b/tasks/agg-p10-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 12, 19, 51, 69, 79]' > "$answer" diff --git a/tasks/agg-p10-n06-s05/task.toml b/tasks/agg-p10-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3b2eb64b26225365708c9e4c51301fcce5768cf7 --- /dev/null +++ b/tasks/agg-p10-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n06-s05/tests/expected.json b/tasks/agg-p10-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e8a431f5783d88a5817930ee9515aeffa780f337 --- /dev/null +++ b/tasks/agg-p10-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[5, 12, 19, 51, 69, 79] diff --git a/tasks/agg-p10-n06-s05/tests/test.sh b/tasks/agg-p10-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n06-s06/instruction.md b/tasks/agg-p10-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f31755215085ecac3c28fde5f5e2ac8e24c067dd --- /dev/null +++ b/tasks/agg-p10-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n06-s06/solution/solve.sh b/tasks/agg-p10-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..19cdf06423737da10ac10c8538e282b90dbff536 --- /dev/null +++ b/tasks/agg-p10-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 12, 19, 51, 69, 79]' > "$answer" diff --git a/tasks/agg-p10-n06-s06/task.toml b/tasks/agg-p10-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9f6eddb571b7cce2ea52ade8b69e13246c988f55 --- /dev/null +++ b/tasks/agg-p10-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n06-s06/tests/expected.json b/tasks/agg-p10-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e8a431f5783d88a5817930ee9515aeffa780f337 --- /dev/null +++ b/tasks/agg-p10-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[5, 12, 19, 51, 69, 79] diff --git a/tasks/agg-p10-n06-s06/tests/test.sh b/tasks/agg-p10-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n08-s01/instruction.md b/tasks/agg-p10-n08-s01/instruction.md index cfd28188a178a5f820bd132665deb26a6bb181c9..4ecbeb7af5580eb469b9bc54604d3613b27a96ef 100644 --- a/tasks/agg-p10-n08-s01/instruction.md +++ b/tasks/agg-p10-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n08-s01/tests/test.sh b/tasks/agg-p10-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n08-s01/tests/test.sh +++ b/tasks/agg-p10-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n08-s02/instruction.md b/tasks/agg-p10-n08-s02/instruction.md index 75a1841e2fc9e7879f1e791caf8e81f6f6010a03..12ba1f30aac4454bd67f28a075ba69aa537ce1a2 100644 --- a/tasks/agg-p10-n08-s02/instruction.md +++ b/tasks/agg-p10-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n08-s02/tests/test.sh b/tasks/agg-p10-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n08-s02/tests/test.sh +++ b/tasks/agg-p10-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n08-s03/instruction.md b/tasks/agg-p10-n08-s03/instruction.md index e9260e41c83d52ff81d0cd24ab3bbcb722f43da1..002ff3f87af341baf7f43668a34cdab1fe436a4d 100644 --- a/tasks/agg-p10-n08-s03/instruction.md +++ b/tasks/agg-p10-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n08-s03/tests/test.sh b/tasks/agg-p10-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n08-s03/tests/test.sh +++ b/tasks/agg-p10-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n08-s04/instruction.md b/tasks/agg-p10-n08-s04/instruction.md index a94aeebf9e8286b30025fd530a9c33d5587c12ad..cf4266e28b21bdd50d23c3824ddaec94fe1bd8d5 100644 --- a/tasks/agg-p10-n08-s04/instruction.md +++ b/tasks/agg-p10-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n08-s04/tests/test.sh b/tasks/agg-p10-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n08-s04/tests/test.sh +++ b/tasks/agg-p10-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n08-s05/instruction.md b/tasks/agg-p10-n08-s05/instruction.md index d356bb5ea0ea3378245500692d3d1b5cb41a9db4..5cb171c56a05b0aca43138d82992e7a971af7c0e 100644 --- a/tasks/agg-p10-n08-s05/instruction.md +++ b/tasks/agg-p10-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n08-s05/tests/test.sh b/tasks/agg-p10-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n08-s05/tests/test.sh +++ b/tasks/agg-p10-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n08-s06/instruction.md b/tasks/agg-p10-n08-s06/instruction.md index 820ba5235eb72205ef96f9b1bab51820f47403d9..e0abdd89b76cbe13833aaa27e72fee82f7079852 100644 --- a/tasks/agg-p10-n08-s06/instruction.md +++ b/tasks/agg-p10-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n08-s06/tests/test.sh b/tasks/agg-p10-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n08-s06/tests/test.sh +++ b/tasks/agg-p10-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n08-s07/instruction.md b/tasks/agg-p10-n08-s07/instruction.md index 6770f155a73f8160420b131a19f4e1c1ecc0b159..a807811225f95af60844b17548c90165594e5e78 100644 --- a/tasks/agg-p10-n08-s07/instruction.md +++ b/tasks/agg-p10-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n08-s07/tests/test.sh b/tasks/agg-p10-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n08-s07/tests/test.sh +++ b/tasks/agg-p10-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n08-s08/instruction.md b/tasks/agg-p10-n08-s08/instruction.md index c9a097aea27ac1d5b1983257532ee4e74173b065..b3b60453fff21f84359af5d8f18f8e9a25c96c38 100644 --- a/tasks/agg-p10-n08-s08/instruction.md +++ b/tasks/agg-p10-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n08-s08/tests/test.sh b/tasks/agg-p10-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n08-s08/tests/test.sh +++ b/tasks/agg-p10-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n12-s01/instruction.md b/tasks/agg-p10-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8be11b5883f82241c1bfcc5354eaf615e8c586fb --- /dev/null +++ b/tasks/agg-p10-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n12-s01/solution/solve.sh b/tasks/agg-p10-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1ecdf49a014e652b7b8c8268485904a0451adb1 --- /dev/null +++ b/tasks/agg-p10-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96]' > "$answer" diff --git a/tasks/agg-p10-n12-s01/task.toml b/tasks/agg-p10-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6e7faf6500a92cc2ae3cbe7002ad4e46c1fe9ed6 --- /dev/null +++ b/tasks/agg-p10-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n12-s01/tests/expected.json b/tasks/agg-p10-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e2f77aae7f599badfd7da110ff63ab66910742d8 --- /dev/null +++ b/tasks/agg-p10-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96] diff --git a/tasks/agg-p10-n12-s01/tests/test.sh b/tasks/agg-p10-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n12-s02/instruction.md b/tasks/agg-p10-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9b0eae8063e1419234bd5a4b5a1fded790f6da23 --- /dev/null +++ b/tasks/agg-p10-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n12-s02/solution/solve.sh b/tasks/agg-p10-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1ecdf49a014e652b7b8c8268485904a0451adb1 --- /dev/null +++ b/tasks/agg-p10-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96]' > "$answer" diff --git a/tasks/agg-p10-n12-s02/task.toml b/tasks/agg-p10-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c237bfba428d33b7b21540c3b96d3e87b2dcc799 --- /dev/null +++ b/tasks/agg-p10-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n12-s02/tests/expected.json b/tasks/agg-p10-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e2f77aae7f599badfd7da110ff63ab66910742d8 --- /dev/null +++ b/tasks/agg-p10-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96] diff --git a/tasks/agg-p10-n12-s02/tests/test.sh b/tasks/agg-p10-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n12-s03/instruction.md b/tasks/agg-p10-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d20cc8cc1f1c9617a83e07868fc43399bd7b4a36 --- /dev/null +++ b/tasks/agg-p10-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is nineteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n12-s03/solution/solve.sh b/tasks/agg-p10-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1ecdf49a014e652b7b8c8268485904a0451adb1 --- /dev/null +++ b/tasks/agg-p10-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96]' > "$answer" diff --git a/tasks/agg-p10-n12-s03/task.toml b/tasks/agg-p10-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e8f10d059932ec4a39819fbd863e7b9956980058 --- /dev/null +++ b/tasks/agg-p10-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n12-s03/tests/expected.json b/tasks/agg-p10-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e2f77aae7f599badfd7da110ff63ab66910742d8 --- /dev/null +++ b/tasks/agg-p10-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96] diff --git a/tasks/agg-p10-n12-s03/tests/test.sh b/tasks/agg-p10-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n12-s04/instruction.md b/tasks/agg-p10-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cbefd6b3434fac66c24e06d94b9c3c278b95dbfb --- /dev/null +++ b/tasks/agg-p10-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twelve. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n12-s04/solution/solve.sh b/tasks/agg-p10-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1ecdf49a014e652b7b8c8268485904a0451adb1 --- /dev/null +++ b/tasks/agg-p10-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96]' > "$answer" diff --git a/tasks/agg-p10-n12-s04/task.toml b/tasks/agg-p10-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3f0018d52e650e9782fa96ccfeefd4fca521d26e --- /dev/null +++ b/tasks/agg-p10-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n12-s04/tests/expected.json b/tasks/agg-p10-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e2f77aae7f599badfd7da110ff63ab66910742d8 --- /dev/null +++ b/tasks/agg-p10-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96] diff --git a/tasks/agg-p10-n12-s04/tests/test.sh b/tasks/agg-p10-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n12-s05/instruction.md b/tasks/agg-p10-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d78566c7957cbe8132af56f4888ef6e81649dcb3 --- /dev/null +++ b/tasks/agg-p10-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n12-s05/solution/solve.sh b/tasks/agg-p10-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1ecdf49a014e652b7b8c8268485904a0451adb1 --- /dev/null +++ b/tasks/agg-p10-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96]' > "$answer" diff --git a/tasks/agg-p10-n12-s05/task.toml b/tasks/agg-p10-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3f2f6e7cc9a1d9cc2c7f07ce0c495a0fb3cd8ac9 --- /dev/null +++ b/tasks/agg-p10-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n12-s05/tests/expected.json b/tasks/agg-p10-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e2f77aae7f599badfd7da110ff63ab66910742d8 --- /dev/null +++ b/tasks/agg-p10-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96] diff --git a/tasks/agg-p10-n12-s05/tests/test.sh b/tasks/agg-p10-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n12-s06/instruction.md b/tasks/agg-p10-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a6f6c527d4c1aacdad41d32eff67af8f36c275ba --- /dev/null +++ b/tasks/agg-p10-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n12-s06/solution/solve.sh b/tasks/agg-p10-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1ecdf49a014e652b7b8c8268485904a0451adb1 --- /dev/null +++ b/tasks/agg-p10-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96]' > "$answer" diff --git a/tasks/agg-p10-n12-s06/task.toml b/tasks/agg-p10-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bacd2f24a0e42b81dcf42df1104d75bcd24186dd --- /dev/null +++ b/tasks/agg-p10-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n12-s06/tests/expected.json b/tasks/agg-p10-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e2f77aae7f599badfd7da110ff63ab66910742d8 --- /dev/null +++ b/tasks/agg-p10-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96] diff --git a/tasks/agg-p10-n12-s06/tests/test.sh b/tasks/agg-p10-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n12-s07/instruction.md b/tasks/agg-p10-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7c90856f9c373634a273d06e4b993632457cf3cf --- /dev/null +++ b/tasks/agg-p10-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n12-s07/solution/solve.sh b/tasks/agg-p10-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1ecdf49a014e652b7b8c8268485904a0451adb1 --- /dev/null +++ b/tasks/agg-p10-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96]' > "$answer" diff --git a/tasks/agg-p10-n12-s07/task.toml b/tasks/agg-p10-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..81b26d52a3ddcb5518630b27f1064287354de1f7 --- /dev/null +++ b/tasks/agg-p10-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n12-s07/tests/expected.json b/tasks/agg-p10-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e2f77aae7f599badfd7da110ff63ab66910742d8 --- /dev/null +++ b/tasks/agg-p10-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96] diff --git a/tasks/agg-p10-n12-s07/tests/test.sh b/tasks/agg-p10-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n12-s08/instruction.md b/tasks/agg-p10-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f2c76bb45009aa4b02f25d7f7c4771d329f4cb89 --- /dev/null +++ b/tasks/agg-p10-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n12-s08/solution/solve.sh b/tasks/agg-p10-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1ecdf49a014e652b7b8c8268485904a0451adb1 --- /dev/null +++ b/tasks/agg-p10-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96]' > "$answer" diff --git a/tasks/agg-p10-n12-s08/task.toml b/tasks/agg-p10-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6a11ea760788f2f055465ccfe8a08495a591c038 --- /dev/null +++ b/tasks/agg-p10-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n12-s08/tests/expected.json b/tasks/agg-p10-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e2f77aae7f599badfd7da110ff63ab66910742d8 --- /dev/null +++ b/tasks/agg-p10-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96] diff --git a/tasks/agg-p10-n12-s08/tests/test.sh b/tasks/agg-p10-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n12-s09/instruction.md b/tasks/agg-p10-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..94b2bafb52358803774fef0f96566ce593de1b99 --- /dev/null +++ b/tasks/agg-p10-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n12-s09/solution/solve.sh b/tasks/agg-p10-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1ecdf49a014e652b7b8c8268485904a0451adb1 --- /dev/null +++ b/tasks/agg-p10-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96]' > "$answer" diff --git a/tasks/agg-p10-n12-s09/task.toml b/tasks/agg-p10-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..753898e6b87bb836d7f723dbd5c7fc941fc1e8c0 --- /dev/null +++ b/tasks/agg-p10-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n12-s09/tests/expected.json b/tasks/agg-p10-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e2f77aae7f599badfd7da110ff63ab66910742d8 --- /dev/null +++ b/tasks/agg-p10-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96] diff --git a/tasks/agg-p10-n12-s09/tests/test.sh b/tasks/agg-p10-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n12-s10/instruction.md b/tasks/agg-p10-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..297e7df5ad0e1e0ae0182d7fbd8be00d892a2f7e --- /dev/null +++ b/tasks/agg-p10-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n12-s10/solution/solve.sh b/tasks/agg-p10-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1ecdf49a014e652b7b8c8268485904a0451adb1 --- /dev/null +++ b/tasks/agg-p10-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96]' > "$answer" diff --git a/tasks/agg-p10-n12-s10/task.toml b/tasks/agg-p10-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..52b0245ce797684bf5e3eddc3fd65b12812005d0 --- /dev/null +++ b/tasks/agg-p10-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n12-s10/tests/expected.json b/tasks/agg-p10-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e2f77aae7f599badfd7da110ff63ab66910742d8 --- /dev/null +++ b/tasks/agg-p10-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96] diff --git a/tasks/agg-p10-n12-s10/tests/test.sh b/tasks/agg-p10-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n12-s11/instruction.md b/tasks/agg-p10-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..519523fa549585a9595ce676c83c5ebd96f5e138 --- /dev/null +++ b/tasks/agg-p10-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n12-s11/solution/solve.sh b/tasks/agg-p10-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1ecdf49a014e652b7b8c8268485904a0451adb1 --- /dev/null +++ b/tasks/agg-p10-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96]' > "$answer" diff --git a/tasks/agg-p10-n12-s11/task.toml b/tasks/agg-p10-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0c2c25a89216f007c9683f342c3ebf956dc473d3 --- /dev/null +++ b/tasks/agg-p10-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n12-s11/tests/expected.json b/tasks/agg-p10-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e2f77aae7f599badfd7da110ff63ab66910742d8 --- /dev/null +++ b/tasks/agg-p10-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96] diff --git a/tasks/agg-p10-n12-s11/tests/test.sh b/tasks/agg-p10-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n12-s12/instruction.md b/tasks/agg-p10-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2f01a3e73dbd4b8b1058dd60451773afa73f14c7 --- /dev/null +++ b/tasks/agg-p10-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n12-s12/solution/solve.sh b/tasks/agg-p10-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b1ecdf49a014e652b7b8c8268485904a0451adb1 --- /dev/null +++ b/tasks/agg-p10-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96]' > "$answer" diff --git a/tasks/agg-p10-n12-s12/task.toml b/tasks/agg-p10-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9697f2c0c7378c762fde04ec7913ab8313989f1a --- /dev/null +++ b/tasks/agg-p10-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p10-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 10 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p10-n12-s12/tests/expected.json b/tasks/agg-p10-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e2f77aae7f599badfd7da110ff63ab66910742d8 --- /dev/null +++ b/tasks/agg-p10-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 12, 19, 25, 32, 51, 56, 63, 69, 79, 96] diff --git a/tasks/agg-p10-n12-s12/tests/test.sh b/tasks/agg-p10-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p10-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p10-n16-s01/instruction.md b/tasks/agg-p10-n16-s01/instruction.md index 7db3d283effcee2e29406da16a63a785bcffa3f6..bd72b4cb3ef80fa76d635dbc7ca834354ab9abf2 100644 --- a/tasks/agg-p10-n16-s01/instruction.md +++ b/tasks/agg-p10-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s01/tests/test.sh b/tasks/agg-p10-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s01/tests/test.sh +++ b/tasks/agg-p10-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s02/instruction.md b/tasks/agg-p10-n16-s02/instruction.md index 17dddcebb1a38d642707c9e410dad0c89d830fb7..b2dbec3d0f3048cf387c99c193a35cad3f00783a 100644 --- a/tasks/agg-p10-n16-s02/instruction.md +++ b/tasks/agg-p10-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s02/tests/test.sh b/tasks/agg-p10-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s02/tests/test.sh +++ b/tasks/agg-p10-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s03/instruction.md b/tasks/agg-p10-n16-s03/instruction.md index 689dc52da259912a8583e539c40d32957d6e1982..9e4a131dc1a41521b0b243cd7a381ee18c406e61 100644 --- a/tasks/agg-p10-n16-s03/instruction.md +++ b/tasks/agg-p10-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s03/tests/test.sh b/tasks/agg-p10-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s03/tests/test.sh +++ b/tasks/agg-p10-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s04/instruction.md b/tasks/agg-p10-n16-s04/instruction.md index 0d9b54e563f9bb163b48be34eb84abe311c00e06..ceda32fde53a1c10e904f97ed076f49abdf1f3a5 100644 --- a/tasks/agg-p10-n16-s04/instruction.md +++ b/tasks/agg-p10-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s04/tests/test.sh b/tasks/agg-p10-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s04/tests/test.sh +++ b/tasks/agg-p10-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s05/instruction.md b/tasks/agg-p10-n16-s05/instruction.md index f9807e3dca090e22409202efda192d4a7b9f5ac5..f9190cd6f2d679efa59828aa0ffdff708c0d41ce 100644 --- a/tasks/agg-p10-n16-s05/instruction.md +++ b/tasks/agg-p10-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s05/tests/test.sh b/tasks/agg-p10-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s05/tests/test.sh +++ b/tasks/agg-p10-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s06/instruction.md b/tasks/agg-p10-n16-s06/instruction.md index fb03ade0279ecf776a2ba0e785bd133ee36ecac6..3a629248b9ad5c45b818dd2ecd91107928508549 100644 --- a/tasks/agg-p10-n16-s06/instruction.md +++ b/tasks/agg-p10-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s06/tests/test.sh b/tasks/agg-p10-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s06/tests/test.sh +++ b/tasks/agg-p10-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s07/instruction.md b/tasks/agg-p10-n16-s07/instruction.md index eec0889f35f181e3d5ee370338313f8afc894fe8..741d5c897d7dc6413c1bb96a8b00478c60c908ba 100644 --- a/tasks/agg-p10-n16-s07/instruction.md +++ b/tasks/agg-p10-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s07/tests/test.sh b/tasks/agg-p10-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s07/tests/test.sh +++ b/tasks/agg-p10-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s08/instruction.md b/tasks/agg-p10-n16-s08/instruction.md index 3b063473af96559ef580cbc092e75977831e3156..4703f6654b54dad53866503ef64f717d4939884b 100644 --- a/tasks/agg-p10-n16-s08/instruction.md +++ b/tasks/agg-p10-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s08/tests/test.sh b/tasks/agg-p10-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s08/tests/test.sh +++ b/tasks/agg-p10-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s09/instruction.md b/tasks/agg-p10-n16-s09/instruction.md index 9e673d50df3d0049f8ebbc5f08e69f16f929b38f..f17a373aff362de5ccbc3d2752a0dc99bf30605b 100644 --- a/tasks/agg-p10-n16-s09/instruction.md +++ b/tasks/agg-p10-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s09/tests/test.sh b/tasks/agg-p10-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s09/tests/test.sh +++ b/tasks/agg-p10-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s10/instruction.md b/tasks/agg-p10-n16-s10/instruction.md index 04c3f6729149d2802728807768786a453bb32941..66fed180f5ece962b8f35828f82d008e1814560f 100644 --- a/tasks/agg-p10-n16-s10/instruction.md +++ b/tasks/agg-p10-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s10/tests/test.sh b/tasks/agg-p10-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s10/tests/test.sh +++ b/tasks/agg-p10-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s11/instruction.md b/tasks/agg-p10-n16-s11/instruction.md index 9137a4ab46a628c60be0b75972f0a9947e2c3883..4c327201eb92082d75247de85279b2149f069a49 100644 --- a/tasks/agg-p10-n16-s11/instruction.md +++ b/tasks/agg-p10-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s11/tests/test.sh b/tasks/agg-p10-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s11/tests/test.sh +++ b/tasks/agg-p10-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s12/instruction.md b/tasks/agg-p10-n16-s12/instruction.md index c06c0812a7b7ea5a0caff9ffd07ddd76bc328ac2..769741a0d886c36eda905f6aea67cd579968498f 100644 --- a/tasks/agg-p10-n16-s12/instruction.md +++ b/tasks/agg-p10-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s12/tests/test.sh b/tasks/agg-p10-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s12/tests/test.sh +++ b/tasks/agg-p10-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s13/instruction.md b/tasks/agg-p10-n16-s13/instruction.md index 0d9b54e563f9bb163b48be34eb84abe311c00e06..ceda32fde53a1c10e904f97ed076f49abdf1f3a5 100644 --- a/tasks/agg-p10-n16-s13/instruction.md +++ b/tasks/agg-p10-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s13/tests/test.sh b/tasks/agg-p10-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s13/tests/test.sh +++ b/tasks/agg-p10-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s14/instruction.md b/tasks/agg-p10-n16-s14/instruction.md index 07c9e57a88a9821b15aef8e576670581ef52b8cf..f17e7c1550785116b92d6c8da78aeb05d8edf6c0 100644 --- a/tasks/agg-p10-n16-s14/instruction.md +++ b/tasks/agg-p10-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s14/tests/test.sh b/tasks/agg-p10-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s14/tests/test.sh +++ b/tasks/agg-p10-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s15/instruction.md b/tasks/agg-p10-n16-s15/instruction.md index e5c784e3be1e3c1c8c8931ac55ae2345c1d7e341..0132dbcb468155a843c8c2b7a4a9e6ca2be0c499 100644 --- a/tasks/agg-p10-n16-s15/instruction.md +++ b/tasks/agg-p10-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s15/tests/test.sh b/tasks/agg-p10-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s15/tests/test.sh +++ b/tasks/agg-p10-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p10-n16-s16/instruction.md b/tasks/agg-p10-n16-s16/instruction.md index dbf2061d7fb14b0259a175fc5733c9416d2923e1..c504d6aa634b53ffe7cd9828aca879ab0d12da11 100644 --- a/tasks/agg-p10-n16-s16/instruction.md +++ b/tasks/agg-p10-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p10-n16-s16/tests/test.sh b/tasks/agg-p10-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p10-n16-s16/tests/test.sh +++ b/tasks/agg-p10-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n01-s01/instruction.md b/tasks/agg-p11-n01-s01/instruction.md index 63c66a57fcc0f7e7205cf3c02e350bd78aa36011..5e57e2f23a2da2ad552e74ad5a86149921d87800 100644 --- a/tasks/agg-p11-n01-s01/instruction.md +++ b/tasks/agg-p11-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is twelve. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p11-n01-s01/tests/test.sh b/tasks/agg-p11-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n01-s01/tests/test.sh +++ b/tasks/agg-p11-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n02-s01/instruction.md b/tasks/agg-p11-n02-s01/instruction.md index e6f0133700eb2768a194d57ce917bf61aec6d351..9732d33468db19e2e7201628565cd45e9bc64a38 100644 --- a/tasks/agg-p11-n02-s01/instruction.md +++ b/tasks/agg-p11-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n02-s01/tests/test.sh b/tasks/agg-p11-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n02-s01/tests/test.sh +++ b/tasks/agg-p11-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n02-s02/instruction.md b/tasks/agg-p11-n02-s02/instruction.md index ba3f5fc534fc641a0e141a433c475279d476bede..4dc447a20ac545b3c39f9483aa42635bc6f022a9 100644 --- a/tasks/agg-p11-n02-s02/instruction.md +++ b/tasks/agg-p11-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n02-s02/tests/test.sh b/tasks/agg-p11-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n02-s02/tests/test.sh +++ b/tasks/agg-p11-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n04-s01/instruction.md b/tasks/agg-p11-n04-s01/instruction.md index 443e407657e73595d97fcfe569c9474712df94c6..dc553c9c6f293e57dbc034e45d381265cb22e253 100644 --- a/tasks/agg-p11-n04-s01/instruction.md +++ b/tasks/agg-p11-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n04-s01/tests/test.sh b/tasks/agg-p11-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n04-s01/tests/test.sh +++ b/tasks/agg-p11-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n04-s02/instruction.md b/tasks/agg-p11-n04-s02/instruction.md index 05cf8bca1a48c1b643c1d06a14adbefc29b2f42c..df7686f962b99c7561b5ea3622470feb276c673f 100644 --- a/tasks/agg-p11-n04-s02/instruction.md +++ b/tasks/agg-p11-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n04-s02/tests/test.sh b/tasks/agg-p11-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n04-s02/tests/test.sh +++ b/tasks/agg-p11-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n04-s03/instruction.md b/tasks/agg-p11-n04-s03/instruction.md index 07f10f6007ffc85ea834183f2b7a07c54847d17b..4b96c2b667bc79323d49ce2b28e66ef6a0d14150 100644 --- a/tasks/agg-p11-n04-s03/instruction.md +++ b/tasks/agg-p11-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n04-s03/tests/test.sh b/tasks/agg-p11-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n04-s03/tests/test.sh +++ b/tasks/agg-p11-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n04-s04/instruction.md b/tasks/agg-p11-n04-s04/instruction.md index 9989acbc218f753b3cf2a0c28b48737e8f8c3b52..9c75345c066b2cd303e643afacfdec6be7f1e474 100644 --- a/tasks/agg-p11-n04-s04/instruction.md +++ b/tasks/agg-p11-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n04-s04/tests/test.sh b/tasks/agg-p11-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n04-s04/tests/test.sh +++ b/tasks/agg-p11-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n06-s01/instruction.md b/tasks/agg-p11-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..64ac36448e2dbf7956db9f18492ddc2ab2e6610f --- /dev/null +++ b/tasks/agg-p11-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twelve. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n06-s01/solution/solve.sh b/tasks/agg-p11-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..998a22332d40d26994448655ec460f98833c37be --- /dev/null +++ b/tasks/agg-p11-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 67, 75, 78, 84, 98]' > "$answer" diff --git a/tasks/agg-p11-n06-s01/task.toml b/tasks/agg-p11-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..92f3fed40123d2d780e56f013288718bace7e1e4 --- /dev/null +++ b/tasks/agg-p11-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n06-s01/tests/expected.json b/tasks/agg-p11-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..49214609df535d873f140b7498ed7da556079f1a --- /dev/null +++ b/tasks/agg-p11-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[12, 67, 75, 78, 84, 98] diff --git a/tasks/agg-p11-n06-s01/tests/test.sh b/tasks/agg-p11-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n06-s02/instruction.md b/tasks/agg-p11-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7cab54770d50778fdf62ebe626c1edc74bacf1fc --- /dev/null +++ b/tasks/agg-p11-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n06-s02/solution/solve.sh b/tasks/agg-p11-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..998a22332d40d26994448655ec460f98833c37be --- /dev/null +++ b/tasks/agg-p11-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 67, 75, 78, 84, 98]' > "$answer" diff --git a/tasks/agg-p11-n06-s02/task.toml b/tasks/agg-p11-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b3678d798b51e4449b691b39101ca9f6bab6c626 --- /dev/null +++ b/tasks/agg-p11-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n06-s02/tests/expected.json b/tasks/agg-p11-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..49214609df535d873f140b7498ed7da556079f1a --- /dev/null +++ b/tasks/agg-p11-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[12, 67, 75, 78, 84, 98] diff --git a/tasks/agg-p11-n06-s02/tests/test.sh b/tasks/agg-p11-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n06-s03/instruction.md b/tasks/agg-p11-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..02ccd25af05fbc1c2117058b43bc47eb9c7943db --- /dev/null +++ b/tasks/agg-p11-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n06-s03/solution/solve.sh b/tasks/agg-p11-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..998a22332d40d26994448655ec460f98833c37be --- /dev/null +++ b/tasks/agg-p11-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 67, 75, 78, 84, 98]' > "$answer" diff --git a/tasks/agg-p11-n06-s03/task.toml b/tasks/agg-p11-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f5b10fa15e76bf2758b9ff03a944a6c4083f9367 --- /dev/null +++ b/tasks/agg-p11-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n06-s03/tests/expected.json b/tasks/agg-p11-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..49214609df535d873f140b7498ed7da556079f1a --- /dev/null +++ b/tasks/agg-p11-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[12, 67, 75, 78, 84, 98] diff --git a/tasks/agg-p11-n06-s03/tests/test.sh b/tasks/agg-p11-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n06-s04/instruction.md b/tasks/agg-p11-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..dcbded2dd49a98d0c30372568e3cdcae52a34893 --- /dev/null +++ b/tasks/agg-p11-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n06-s04/solution/solve.sh b/tasks/agg-p11-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..998a22332d40d26994448655ec460f98833c37be --- /dev/null +++ b/tasks/agg-p11-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 67, 75, 78, 84, 98]' > "$answer" diff --git a/tasks/agg-p11-n06-s04/task.toml b/tasks/agg-p11-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ba8da259c74f3a784ab3f0df7d7167a491f6899e --- /dev/null +++ b/tasks/agg-p11-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n06-s04/tests/expected.json b/tasks/agg-p11-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..49214609df535d873f140b7498ed7da556079f1a --- /dev/null +++ b/tasks/agg-p11-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[12, 67, 75, 78, 84, 98] diff --git a/tasks/agg-p11-n06-s04/tests/test.sh b/tasks/agg-p11-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n06-s05/instruction.md b/tasks/agg-p11-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8cccd6bb4840d122bc891dcbcfc377ca88a66413 --- /dev/null +++ b/tasks/agg-p11-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n06-s05/solution/solve.sh b/tasks/agg-p11-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..998a22332d40d26994448655ec460f98833c37be --- /dev/null +++ b/tasks/agg-p11-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 67, 75, 78, 84, 98]' > "$answer" diff --git a/tasks/agg-p11-n06-s05/task.toml b/tasks/agg-p11-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..24a6326b2f19189ecb2d413be94368bcdf8215ce --- /dev/null +++ b/tasks/agg-p11-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n06-s05/tests/expected.json b/tasks/agg-p11-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..49214609df535d873f140b7498ed7da556079f1a --- /dev/null +++ b/tasks/agg-p11-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[12, 67, 75, 78, 84, 98] diff --git a/tasks/agg-p11-n06-s05/tests/test.sh b/tasks/agg-p11-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n06-s06/instruction.md b/tasks/agg-p11-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..044902def78d0346c915e551662be15393efe3d7 --- /dev/null +++ b/tasks/agg-p11-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n06-s06/solution/solve.sh b/tasks/agg-p11-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..998a22332d40d26994448655ec460f98833c37be --- /dev/null +++ b/tasks/agg-p11-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 67, 75, 78, 84, 98]' > "$answer" diff --git a/tasks/agg-p11-n06-s06/task.toml b/tasks/agg-p11-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0636d46d6a6b1cf3f9df5488be6fadbd3a6e9bcc --- /dev/null +++ b/tasks/agg-p11-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n06-s06/tests/expected.json b/tasks/agg-p11-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..49214609df535d873f140b7498ed7da556079f1a --- /dev/null +++ b/tasks/agg-p11-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[12, 67, 75, 78, 84, 98] diff --git a/tasks/agg-p11-n06-s06/tests/test.sh b/tasks/agg-p11-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n08-s01/instruction.md b/tasks/agg-p11-n08-s01/instruction.md index a94aeebf9e8286b30025fd530a9c33d5587c12ad..cf4266e28b21bdd50d23c3824ddaec94fe1bd8d5 100644 --- a/tasks/agg-p11-n08-s01/instruction.md +++ b/tasks/agg-p11-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n08-s01/tests/test.sh b/tasks/agg-p11-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n08-s01/tests/test.sh +++ b/tasks/agg-p11-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n08-s02/instruction.md b/tasks/agg-p11-n08-s02/instruction.md index 9644ae68367685a27d81096586413b9006b672c5..734b0366f68c6ff5bf212299c33e9d75903e7a25 100644 --- a/tasks/agg-p11-n08-s02/instruction.md +++ b/tasks/agg-p11-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n08-s02/tests/test.sh b/tasks/agg-p11-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n08-s02/tests/test.sh +++ b/tasks/agg-p11-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n08-s03/instruction.md b/tasks/agg-p11-n08-s03/instruction.md index 31b49a7ebafd50c4671a7ca5d0e8f77ae4267acd..2b98ce993f82e9e48e70ddc092fcf220c5add566 100644 --- a/tasks/agg-p11-n08-s03/instruction.md +++ b/tasks/agg-p11-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n08-s03/tests/test.sh b/tasks/agg-p11-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n08-s03/tests/test.sh +++ b/tasks/agg-p11-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n08-s04/instruction.md b/tasks/agg-p11-n08-s04/instruction.md index 0ee10142e61d08a5571772c533b83202fd01c84e..1d56cadf04393cae3e1d171ef0b958fbd4a2d7f4 100644 --- a/tasks/agg-p11-n08-s04/instruction.md +++ b/tasks/agg-p11-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n08-s04/tests/test.sh b/tasks/agg-p11-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n08-s04/tests/test.sh +++ b/tasks/agg-p11-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n08-s05/instruction.md b/tasks/agg-p11-n08-s05/instruction.md index c462ac9ca802050bd457b3cfba5d7a79b08da47d..8e802c76e52f1cd50ead7780f6b45504832c0a85 100644 --- a/tasks/agg-p11-n08-s05/instruction.md +++ b/tasks/agg-p11-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n08-s05/tests/test.sh b/tasks/agg-p11-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n08-s05/tests/test.sh +++ b/tasks/agg-p11-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n08-s06/instruction.md b/tasks/agg-p11-n08-s06/instruction.md index 6662e6911ad1105e195cbc6e76b3cc8d9854bef3..d4b85483dd2dae073bb973b1851f38367afa7271 100644 --- a/tasks/agg-p11-n08-s06/instruction.md +++ b/tasks/agg-p11-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n08-s06/tests/test.sh b/tasks/agg-p11-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n08-s06/tests/test.sh +++ b/tasks/agg-p11-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n08-s07/instruction.md b/tasks/agg-p11-n08-s07/instruction.md index eee7a0b5f66fc3863f0f9be834031a101d16805b..e18ab9027af739e0c6a8e15c489ac72b51badfe0 100644 --- a/tasks/agg-p11-n08-s07/instruction.md +++ b/tasks/agg-p11-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n08-s07/tests/test.sh b/tasks/agg-p11-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n08-s07/tests/test.sh +++ b/tasks/agg-p11-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n08-s08/instruction.md b/tasks/agg-p11-n08-s08/instruction.md index f175a93401463f943739d764505f2ddcec86791a..85223bfc1cb94e49085ab22c6f699320f0057489 100644 --- a/tasks/agg-p11-n08-s08/instruction.md +++ b/tasks/agg-p11-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n08-s08/tests/test.sh b/tasks/agg-p11-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n08-s08/tests/test.sh +++ b/tasks/agg-p11-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n12-s01/instruction.md b/tasks/agg-p11-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cbefd6b3434fac66c24e06d94b9c3c278b95dbfb --- /dev/null +++ b/tasks/agg-p11-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twelve. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n12-s01/solution/solve.sh b/tasks/agg-p11-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf53ccd1846a9806420365d651a35f151a89620b --- /dev/null +++ b/tasks/agg-p11-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98]' > "$answer" diff --git a/tasks/agg-p11-n12-s01/task.toml b/tasks/agg-p11-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c654c9a182a6e08ba6f6aa0e058c1cc9380da354 --- /dev/null +++ b/tasks/agg-p11-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n12-s01/tests/expected.json b/tasks/agg-p11-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..107d5a4734fe93a1d3f4583264f33ddb14796e41 --- /dev/null +++ b/tasks/agg-p11-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98] diff --git a/tasks/agg-p11-n12-s01/tests/test.sh b/tasks/agg-p11-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n12-s02/instruction.md b/tasks/agg-p11-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ad2da4c7d0d9034ae0a3042bb4c3e9eb59ce689d --- /dev/null +++ b/tasks/agg-p11-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n12-s02/solution/solve.sh b/tasks/agg-p11-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf53ccd1846a9806420365d651a35f151a89620b --- /dev/null +++ b/tasks/agg-p11-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98]' > "$answer" diff --git a/tasks/agg-p11-n12-s02/task.toml b/tasks/agg-p11-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2375abb25f798581cdf8cf6a20390f309f625a2b --- /dev/null +++ b/tasks/agg-p11-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n12-s02/tests/expected.json b/tasks/agg-p11-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..107d5a4734fe93a1d3f4583264f33ddb14796e41 --- /dev/null +++ b/tasks/agg-p11-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98] diff --git a/tasks/agg-p11-n12-s02/tests/test.sh b/tasks/agg-p11-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n12-s03/instruction.md b/tasks/agg-p11-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..af9aae3fa58918121d264b6c2347f0f076dedf53 --- /dev/null +++ b/tasks/agg-p11-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n12-s03/solution/solve.sh b/tasks/agg-p11-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf53ccd1846a9806420365d651a35f151a89620b --- /dev/null +++ b/tasks/agg-p11-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98]' > "$answer" diff --git a/tasks/agg-p11-n12-s03/task.toml b/tasks/agg-p11-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ba9e485789a00670eb8bf27d68f5dcc9bb6e06f2 --- /dev/null +++ b/tasks/agg-p11-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n12-s03/tests/expected.json b/tasks/agg-p11-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..107d5a4734fe93a1d3f4583264f33ddb14796e41 --- /dev/null +++ b/tasks/agg-p11-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98] diff --git a/tasks/agg-p11-n12-s03/tests/test.sh b/tasks/agg-p11-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n12-s04/instruction.md b/tasks/agg-p11-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..054dc42296a82036d581d99f90bd071c5bc61a63 --- /dev/null +++ b/tasks/agg-p11-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n12-s04/solution/solve.sh b/tasks/agg-p11-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf53ccd1846a9806420365d651a35f151a89620b --- /dev/null +++ b/tasks/agg-p11-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98]' > "$answer" diff --git a/tasks/agg-p11-n12-s04/task.toml b/tasks/agg-p11-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1fb1928fcf7243a894d65576512fd2c0856e1ad9 --- /dev/null +++ b/tasks/agg-p11-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n12-s04/tests/expected.json b/tasks/agg-p11-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..107d5a4734fe93a1d3f4583264f33ddb14796e41 --- /dev/null +++ b/tasks/agg-p11-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98] diff --git a/tasks/agg-p11-n12-s04/tests/test.sh b/tasks/agg-p11-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n12-s05/instruction.md b/tasks/agg-p11-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ac0fb3589d74cb9ec090d7919df303360b87a4cd --- /dev/null +++ b/tasks/agg-p11-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n12-s05/solution/solve.sh b/tasks/agg-p11-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf53ccd1846a9806420365d651a35f151a89620b --- /dev/null +++ b/tasks/agg-p11-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98]' > "$answer" diff --git a/tasks/agg-p11-n12-s05/task.toml b/tasks/agg-p11-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1e442608fc9e920ae647f6752c9e99cb0c96800f --- /dev/null +++ b/tasks/agg-p11-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n12-s05/tests/expected.json b/tasks/agg-p11-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..107d5a4734fe93a1d3f4583264f33ddb14796e41 --- /dev/null +++ b/tasks/agg-p11-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98] diff --git a/tasks/agg-p11-n12-s05/tests/test.sh b/tasks/agg-p11-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n12-s06/instruction.md b/tasks/agg-p11-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..50b917cf08b6446450c1a43541739f4d5c2745bd --- /dev/null +++ b/tasks/agg-p11-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n12-s06/solution/solve.sh b/tasks/agg-p11-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf53ccd1846a9806420365d651a35f151a89620b --- /dev/null +++ b/tasks/agg-p11-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98]' > "$answer" diff --git a/tasks/agg-p11-n12-s06/task.toml b/tasks/agg-p11-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..65f794d95405884e67f1f12ce3f0ebe03b0a3f23 --- /dev/null +++ b/tasks/agg-p11-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n12-s06/tests/expected.json b/tasks/agg-p11-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..107d5a4734fe93a1d3f4583264f33ddb14796e41 --- /dev/null +++ b/tasks/agg-p11-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98] diff --git a/tasks/agg-p11-n12-s06/tests/test.sh b/tasks/agg-p11-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n12-s07/instruction.md b/tasks/agg-p11-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..297e7df5ad0e1e0ae0182d7fbd8be00d892a2f7e --- /dev/null +++ b/tasks/agg-p11-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n12-s07/solution/solve.sh b/tasks/agg-p11-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf53ccd1846a9806420365d651a35f151a89620b --- /dev/null +++ b/tasks/agg-p11-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98]' > "$answer" diff --git a/tasks/agg-p11-n12-s07/task.toml b/tasks/agg-p11-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..706a893d369a5394bb11907db8c95ec4dd0fb31b --- /dev/null +++ b/tasks/agg-p11-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n12-s07/tests/expected.json b/tasks/agg-p11-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..107d5a4734fe93a1d3f4583264f33ddb14796e41 --- /dev/null +++ b/tasks/agg-p11-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98] diff --git a/tasks/agg-p11-n12-s07/tests/test.sh b/tasks/agg-p11-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n12-s08/instruction.md b/tasks/agg-p11-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1e4de5bf2858b7b47780fdbcb584221024d8f518 --- /dev/null +++ b/tasks/agg-p11-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eleven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n12-s08/solution/solve.sh b/tasks/agg-p11-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf53ccd1846a9806420365d651a35f151a89620b --- /dev/null +++ b/tasks/agg-p11-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98]' > "$answer" diff --git a/tasks/agg-p11-n12-s08/task.toml b/tasks/agg-p11-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8292913d7957d8e64b01c62ef2fff1559def2864 --- /dev/null +++ b/tasks/agg-p11-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n12-s08/tests/expected.json b/tasks/agg-p11-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..107d5a4734fe93a1d3f4583264f33ddb14796e41 --- /dev/null +++ b/tasks/agg-p11-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98] diff --git a/tasks/agg-p11-n12-s08/tests/test.sh b/tasks/agg-p11-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n12-s09/instruction.md b/tasks/agg-p11-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..38af6f0bdb6b176fabb077ede4dd67eef822da02 --- /dev/null +++ b/tasks/agg-p11-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n12-s09/solution/solve.sh b/tasks/agg-p11-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf53ccd1846a9806420365d651a35f151a89620b --- /dev/null +++ b/tasks/agg-p11-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98]' > "$answer" diff --git a/tasks/agg-p11-n12-s09/task.toml b/tasks/agg-p11-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e7c4562aefaa4a2a650e06a78f4ae5eb5a52c1d2 --- /dev/null +++ b/tasks/agg-p11-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n12-s09/tests/expected.json b/tasks/agg-p11-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..107d5a4734fe93a1d3f4583264f33ddb14796e41 --- /dev/null +++ b/tasks/agg-p11-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98] diff --git a/tasks/agg-p11-n12-s09/tests/test.sh b/tasks/agg-p11-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n12-s10/instruction.md b/tasks/agg-p11-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1ec3d2a16079c4d9737f2784ae217eea77d88533 --- /dev/null +++ b/tasks/agg-p11-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n12-s10/solution/solve.sh b/tasks/agg-p11-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf53ccd1846a9806420365d651a35f151a89620b --- /dev/null +++ b/tasks/agg-p11-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98]' > "$answer" diff --git a/tasks/agg-p11-n12-s10/task.toml b/tasks/agg-p11-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7e20154458b95ca19d6afa49f30ae4a6e43b413a --- /dev/null +++ b/tasks/agg-p11-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n12-s10/tests/expected.json b/tasks/agg-p11-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..107d5a4734fe93a1d3f4583264f33ddb14796e41 --- /dev/null +++ b/tasks/agg-p11-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98] diff --git a/tasks/agg-p11-n12-s10/tests/test.sh b/tasks/agg-p11-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n12-s11/instruction.md b/tasks/agg-p11-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7ff657bb74acf9250e227987f479f3d6c5ef2c59 --- /dev/null +++ b/tasks/agg-p11-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n12-s11/solution/solve.sh b/tasks/agg-p11-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf53ccd1846a9806420365d651a35f151a89620b --- /dev/null +++ b/tasks/agg-p11-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98]' > "$answer" diff --git a/tasks/agg-p11-n12-s11/task.toml b/tasks/agg-p11-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..aa0c61e6928bb14a06435695326e5893b7f939a4 --- /dev/null +++ b/tasks/agg-p11-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n12-s11/tests/expected.json b/tasks/agg-p11-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..107d5a4734fe93a1d3f4583264f33ddb14796e41 --- /dev/null +++ b/tasks/agg-p11-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98] diff --git a/tasks/agg-p11-n12-s11/tests/test.sh b/tasks/agg-p11-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n12-s12/instruction.md b/tasks/agg-p11-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f7bc3051e09aa70b286064fc6302e7e968c525e --- /dev/null +++ b/tasks/agg-p11-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n12-s12/solution/solve.sh b/tasks/agg-p11-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf53ccd1846a9806420365d651a35f151a89620b --- /dev/null +++ b/tasks/agg-p11-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98]' > "$answer" diff --git a/tasks/agg-p11-n12-s12/task.toml b/tasks/agg-p11-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..04fe3dd429cabe68680a13b74b65eb22108d53b2 --- /dev/null +++ b/tasks/agg-p11-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p11-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 11 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p11-n12-s12/tests/expected.json b/tasks/agg-p11-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..107d5a4734fe93a1d3f4583264f33ddb14796e41 --- /dev/null +++ b/tasks/agg-p11-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[11, 12, 23, 25, 40, 67, 74, 75, 78, 84, 94, 98] diff --git a/tasks/agg-p11-n12-s12/tests/test.sh b/tasks/agg-p11-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p11-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p11-n16-s01/instruction.md b/tasks/agg-p11-n16-s01/instruction.md index 0d9b54e563f9bb163b48be34eb84abe311c00e06..ceda32fde53a1c10e904f97ed076f49abdf1f3a5 100644 --- a/tasks/agg-p11-n16-s01/instruction.md +++ b/tasks/agg-p11-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s01/tests/test.sh b/tasks/agg-p11-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s01/tests/test.sh +++ b/tasks/agg-p11-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s02/instruction.md b/tasks/agg-p11-n16-s02/instruction.md index 66569f84ff1e26966d416028875821de3887ef59..d12c30e5be9a650558f31b2d4d8d71ec3df3c860 100644 --- a/tasks/agg-p11-n16-s02/instruction.md +++ b/tasks/agg-p11-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s02/tests/test.sh b/tasks/agg-p11-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s02/tests/test.sh +++ b/tasks/agg-p11-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s03/instruction.md b/tasks/agg-p11-n16-s03/instruction.md index dbf2061d7fb14b0259a175fc5733c9416d2923e1..c504d6aa634b53ffe7cd9828aca879ab0d12da11 100644 --- a/tasks/agg-p11-n16-s03/instruction.md +++ b/tasks/agg-p11-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s03/tests/test.sh b/tasks/agg-p11-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s03/tests/test.sh +++ b/tasks/agg-p11-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s04/instruction.md b/tasks/agg-p11-n16-s04/instruction.md index bd54876511397bdb80a3c3299556503e1fd15da5..ffc3934425adafa34ada41ff5621db5d0f97a3bb 100644 --- a/tasks/agg-p11-n16-s04/instruction.md +++ b/tasks/agg-p11-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s04/tests/test.sh b/tasks/agg-p11-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s04/tests/test.sh +++ b/tasks/agg-p11-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s05/instruction.md b/tasks/agg-p11-n16-s05/instruction.md index cebfaeb748131e1409dea8040dd71bd8744f230b..f855e374529122b9a74995c685bdc0845b660076 100644 --- a/tasks/agg-p11-n16-s05/instruction.md +++ b/tasks/agg-p11-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s05/tests/test.sh b/tasks/agg-p11-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s05/tests/test.sh +++ b/tasks/agg-p11-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s06/instruction.md b/tasks/agg-p11-n16-s06/instruction.md index 7d5ca093d11da3b866f85566039dbc2ac3bc8c84..7fe87dfffe4ad85e98cdbb07e05a77bf8a912afc 100644 --- a/tasks/agg-p11-n16-s06/instruction.md +++ b/tasks/agg-p11-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s06/tests/test.sh b/tasks/agg-p11-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s06/tests/test.sh +++ b/tasks/agg-p11-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s07/instruction.md b/tasks/agg-p11-n16-s07/instruction.md index 04c3f6729149d2802728807768786a453bb32941..66fed180f5ece962b8f35828f82d008e1814560f 100644 --- a/tasks/agg-p11-n16-s07/instruction.md +++ b/tasks/agg-p11-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s07/tests/test.sh b/tasks/agg-p11-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s07/tests/test.sh +++ b/tasks/agg-p11-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s08/instruction.md b/tasks/agg-p11-n16-s08/instruction.md index 0f12c719492f216b9a3df72f8d724b2259725c6d..1d57dd2778af84c781626fc62484b7570c395997 100644 --- a/tasks/agg-p11-n16-s08/instruction.md +++ b/tasks/agg-p11-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s08/tests/test.sh b/tasks/agg-p11-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s08/tests/test.sh +++ b/tasks/agg-p11-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s09/instruction.md b/tasks/agg-p11-n16-s09/instruction.md index ebe30196b058cfe81ab8a53dd5461649bcf91202..7078e28d54452ae1cab8849d4648225bf8c92be9 100644 --- a/tasks/agg-p11-n16-s09/instruction.md +++ b/tasks/agg-p11-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s09/tests/test.sh b/tasks/agg-p11-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s09/tests/test.sh +++ b/tasks/agg-p11-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s10/instruction.md b/tasks/agg-p11-n16-s10/instruction.md index 07133633c82ade16a43a26c7ec6cacc19d41b3bd..01eccecf7626f9336ce7f443b7b16b6f87314d4c 100644 --- a/tasks/agg-p11-n16-s10/instruction.md +++ b/tasks/agg-p11-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s10/tests/test.sh b/tasks/agg-p11-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s10/tests/test.sh +++ b/tasks/agg-p11-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s11/instruction.md b/tasks/agg-p11-n16-s11/instruction.md index e291fbc977a39d7840cab85af303fe0db4b788af..fd4749e73869d5bc6d1d79fb31331e73e6166413 100644 --- a/tasks/agg-p11-n16-s11/instruction.md +++ b/tasks/agg-p11-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s11/tests/test.sh b/tasks/agg-p11-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s11/tests/test.sh +++ b/tasks/agg-p11-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s12/instruction.md b/tasks/agg-p11-n16-s12/instruction.md index bb8416d585abe15f78ad9eaf98f78cbb202e2f9a..d2b26950540de67dd00f1a8d6c3d9b9c9c52ddf0 100644 --- a/tasks/agg-p11-n16-s12/instruction.md +++ b/tasks/agg-p11-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s12/tests/test.sh b/tasks/agg-p11-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s12/tests/test.sh +++ b/tasks/agg-p11-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s13/instruction.md b/tasks/agg-p11-n16-s13/instruction.md index 8e668cd99b85cf802939dffe8e766b769fcc702e..87e4a5f52a7382cfe533f0cb59ccf7425210c8fe 100644 --- a/tasks/agg-p11-n16-s13/instruction.md +++ b/tasks/agg-p11-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s13/tests/test.sh b/tasks/agg-p11-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s13/tests/test.sh +++ b/tasks/agg-p11-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s14/instruction.md b/tasks/agg-p11-n16-s14/instruction.md index 9137a4ab46a628c60be0b75972f0a9947e2c3883..4c327201eb92082d75247de85279b2149f069a49 100644 --- a/tasks/agg-p11-n16-s14/instruction.md +++ b/tasks/agg-p11-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s14/tests/test.sh b/tasks/agg-p11-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s14/tests/test.sh +++ b/tasks/agg-p11-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s15/instruction.md b/tasks/agg-p11-n16-s15/instruction.md index bb8416d585abe15f78ad9eaf98f78cbb202e2f9a..d2b26950540de67dd00f1a8d6c3d9b9c9c52ddf0 100644 --- a/tasks/agg-p11-n16-s15/instruction.md +++ b/tasks/agg-p11-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s15/tests/test.sh b/tasks/agg-p11-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s15/tests/test.sh +++ b/tasks/agg-p11-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p11-n16-s16/instruction.md b/tasks/agg-p11-n16-s16/instruction.md index 756b66e7e1661b13390451604d8a217c6028d32d..0d5d43f3e734b37862973953434a82fefb583200 100644 --- a/tasks/agg-p11-n16-s16/instruction.md +++ b/tasks/agg-p11-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p11-n16-s16/tests/test.sh b/tasks/agg-p11-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p11-n16-s16/tests/test.sh +++ b/tasks/agg-p11-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n01-s01/instruction.md b/tasks/agg-p12-n01-s01/instruction.md index 92786f28df83c61122b7ded737f313e60d16a0ef..7e99e1e29df6fcf1e71025e8ceb501df3a566cf4 100644 --- a/tasks/agg-p12-n01-s01/instruction.md +++ b/tasks/agg-p12-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is two. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p12-n01-s01/tests/test.sh b/tasks/agg-p12-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n01-s01/tests/test.sh +++ b/tasks/agg-p12-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n02-s01/instruction.md b/tasks/agg-p12-n02-s01/instruction.md index ee80a334a45cab33b7572c3e56b606afdc57e8cb..fe986c224e6587c8c679aa9fe264f4e027d651cc 100644 --- a/tasks/agg-p12-n02-s01/instruction.md +++ b/tasks/agg-p12-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n02-s01/tests/test.sh b/tasks/agg-p12-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n02-s01/tests/test.sh +++ b/tasks/agg-p12-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n02-s02/instruction.md b/tasks/agg-p12-n02-s02/instruction.md index b5075108c8d3fa192822c98138c1537b808f7a4b..b040e25ced8cab5668893454e23755c22107b363 100644 --- a/tasks/agg-p12-n02-s02/instruction.md +++ b/tasks/agg-p12-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n02-s02/tests/test.sh b/tasks/agg-p12-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n02-s02/tests/test.sh +++ b/tasks/agg-p12-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n04-s01/instruction.md b/tasks/agg-p12-n04-s01/instruction.md index 6e765c68a8ebccdbfa860d630754e4c545289435..f70dcf4b53e075b61b7ce011dc745f07653178f2 100644 --- a/tasks/agg-p12-n04-s01/instruction.md +++ b/tasks/agg-p12-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n04-s01/tests/test.sh b/tasks/agg-p12-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n04-s01/tests/test.sh +++ b/tasks/agg-p12-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n04-s02/instruction.md b/tasks/agg-p12-n04-s02/instruction.md index 5dff7097a6f8187c56c213364fcbce4a861f1521..c010843ab5fc134ebc81d67ce8426ba4abf12f89 100644 --- a/tasks/agg-p12-n04-s02/instruction.md +++ b/tasks/agg-p12-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n04-s02/tests/test.sh b/tasks/agg-p12-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n04-s02/tests/test.sh +++ b/tasks/agg-p12-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n04-s03/instruction.md b/tasks/agg-p12-n04-s03/instruction.md index a0bd19ac3b592052aada59c15e572699cc95d555..9f271e6e5bd2b76802e443ccc54abcbd82366944 100644 --- a/tasks/agg-p12-n04-s03/instruction.md +++ b/tasks/agg-p12-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n04-s03/tests/test.sh b/tasks/agg-p12-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n04-s03/tests/test.sh +++ b/tasks/agg-p12-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n04-s04/instruction.md b/tasks/agg-p12-n04-s04/instruction.md index 443e407657e73595d97fcfe569c9474712df94c6..dc553c9c6f293e57dbc034e45d381265cb22e253 100644 --- a/tasks/agg-p12-n04-s04/instruction.md +++ b/tasks/agg-p12-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n04-s04/tests/test.sh b/tasks/agg-p12-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n04-s04/tests/test.sh +++ b/tasks/agg-p12-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n06-s01/instruction.md b/tasks/agg-p12-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a0326b8992e8c1ab2be6d97cef15ae9c5ac1cb46 --- /dev/null +++ b/tasks/agg-p12-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n06-s01/solution/solve.sh b/tasks/agg-p12-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..aff874e1b491a3e9a28df839030b68c793dd71c1 --- /dev/null +++ b/tasks/agg-p12-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 30, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n06-s01/task.toml b/tasks/agg-p12-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7afe09ce33a5da4f619fca5ba8a5dae50994e165 --- /dev/null +++ b/tasks/agg-p12-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n06-s01/tests/expected.json b/tasks/agg-p12-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..403bf2222b79c640dad62c8ce8330a2a2d5df512 --- /dev/null +++ b/tasks/agg-p12-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 30, 50, 95, 99] diff --git a/tasks/agg-p12-n06-s01/tests/test.sh b/tasks/agg-p12-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n06-s02/instruction.md b/tasks/agg-p12-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..547edc0316123f3842221dfa56518d93203667f2 --- /dev/null +++ b/tasks/agg-p12-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n06-s02/solution/solve.sh b/tasks/agg-p12-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..aff874e1b491a3e9a28df839030b68c793dd71c1 --- /dev/null +++ b/tasks/agg-p12-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 30, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n06-s02/task.toml b/tasks/agg-p12-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ddb8ec933db549a679395290e199cacaf4db81de --- /dev/null +++ b/tasks/agg-p12-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n06-s02/tests/expected.json b/tasks/agg-p12-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..403bf2222b79c640dad62c8ce8330a2a2d5df512 --- /dev/null +++ b/tasks/agg-p12-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 30, 50, 95, 99] diff --git a/tasks/agg-p12-n06-s02/tests/test.sh b/tasks/agg-p12-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n06-s03/instruction.md b/tasks/agg-p12-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6edae5a0cf2c4c0ea01e4142c514ceefe0b054da --- /dev/null +++ b/tasks/agg-p12-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n06-s03/solution/solve.sh b/tasks/agg-p12-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..aff874e1b491a3e9a28df839030b68c793dd71c1 --- /dev/null +++ b/tasks/agg-p12-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 30, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n06-s03/task.toml b/tasks/agg-p12-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..284b5a040ab8b3bd738eb0a5b71a054fc2979431 --- /dev/null +++ b/tasks/agg-p12-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n06-s03/tests/expected.json b/tasks/agg-p12-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..403bf2222b79c640dad62c8ce8330a2a2d5df512 --- /dev/null +++ b/tasks/agg-p12-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 30, 50, 95, 99] diff --git a/tasks/agg-p12-n06-s03/tests/test.sh b/tasks/agg-p12-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n06-s04/instruction.md b/tasks/agg-p12-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..64ac36448e2dbf7956db9f18492ddc2ab2e6610f --- /dev/null +++ b/tasks/agg-p12-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twelve. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n06-s04/solution/solve.sh b/tasks/agg-p12-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..aff874e1b491a3e9a28df839030b68c793dd71c1 --- /dev/null +++ b/tasks/agg-p12-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 30, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n06-s04/task.toml b/tasks/agg-p12-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6095f6877f8b6a9b20ed92b5a1686cc13e0eec7c --- /dev/null +++ b/tasks/agg-p12-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n06-s04/tests/expected.json b/tasks/agg-p12-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..403bf2222b79c640dad62c8ce8330a2a2d5df512 --- /dev/null +++ b/tasks/agg-p12-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 30, 50, 95, 99] diff --git a/tasks/agg-p12-n06-s04/tests/test.sh b/tasks/agg-p12-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n06-s05/instruction.md b/tasks/agg-p12-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2da0c8e2076394d2c2f2270ad3b964940d1e2f12 --- /dev/null +++ b/tasks/agg-p12-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n06-s05/solution/solve.sh b/tasks/agg-p12-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..aff874e1b491a3e9a28df839030b68c793dd71c1 --- /dev/null +++ b/tasks/agg-p12-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 30, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n06-s05/task.toml b/tasks/agg-p12-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e4a0bdaa0d087cd7f4bc663e9fbb61a1db927e79 --- /dev/null +++ b/tasks/agg-p12-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n06-s05/tests/expected.json b/tasks/agg-p12-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..403bf2222b79c640dad62c8ce8330a2a2d5df512 --- /dev/null +++ b/tasks/agg-p12-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 30, 50, 95, 99] diff --git a/tasks/agg-p12-n06-s05/tests/test.sh b/tasks/agg-p12-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n06-s06/instruction.md b/tasks/agg-p12-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bf829d764393493c37754d5c1b4044cbd52f94a7 --- /dev/null +++ b/tasks/agg-p12-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n06-s06/solution/solve.sh b/tasks/agg-p12-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..aff874e1b491a3e9a28df839030b68c793dd71c1 --- /dev/null +++ b/tasks/agg-p12-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 30, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n06-s06/task.toml b/tasks/agg-p12-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..45911ebd5fa17f16cba6a9dd38692c79689764be --- /dev/null +++ b/tasks/agg-p12-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n06-s06/tests/expected.json b/tasks/agg-p12-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..403bf2222b79c640dad62c8ce8330a2a2d5df512 --- /dev/null +++ b/tasks/agg-p12-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 30, 50, 95, 99] diff --git a/tasks/agg-p12-n06-s06/tests/test.sh b/tasks/agg-p12-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n08-s01/instruction.md b/tasks/agg-p12-n08-s01/instruction.md index 629e2ae1c728c40605589960cbd96dae496187c1..90998e7368407ace103b85ca771303d040de423a 100644 --- a/tasks/agg-p12-n08-s01/instruction.md +++ b/tasks/agg-p12-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n08-s01/tests/test.sh b/tasks/agg-p12-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n08-s01/tests/test.sh +++ b/tasks/agg-p12-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n08-s02/instruction.md b/tasks/agg-p12-n08-s02/instruction.md index 3e2cf199d0c7560bff5db95d105fc3d398218b9b..1851aafed962daf32119d5a471e50c234bb89b71 100644 --- a/tasks/agg-p12-n08-s02/instruction.md +++ b/tasks/agg-p12-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n08-s02/tests/test.sh b/tasks/agg-p12-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n08-s02/tests/test.sh +++ b/tasks/agg-p12-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n08-s03/instruction.md b/tasks/agg-p12-n08-s03/instruction.md index a042cb763ccdabe4fefaa1c5911478c0a369e6d0..404dd56dd7f109b5fe4e8b8fdcf1e15a36a23e04 100644 --- a/tasks/agg-p12-n08-s03/instruction.md +++ b/tasks/agg-p12-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n08-s03/tests/test.sh b/tasks/agg-p12-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n08-s03/tests/test.sh +++ b/tasks/agg-p12-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n08-s04/instruction.md b/tasks/agg-p12-n08-s04/instruction.md index a94aeebf9e8286b30025fd530a9c33d5587c12ad..cf4266e28b21bdd50d23c3824ddaec94fe1bd8d5 100644 --- a/tasks/agg-p12-n08-s04/instruction.md +++ b/tasks/agg-p12-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n08-s04/tests/test.sh b/tasks/agg-p12-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n08-s04/tests/test.sh +++ b/tasks/agg-p12-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n08-s05/instruction.md b/tasks/agg-p12-n08-s05/instruction.md index 20c75cc16db467c29e541a706205beed9fbbe75d..fa30070f61094288c088b08bfc8b901d9e75a2c6 100644 --- a/tasks/agg-p12-n08-s05/instruction.md +++ b/tasks/agg-p12-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n08-s05/tests/test.sh b/tasks/agg-p12-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n08-s05/tests/test.sh +++ b/tasks/agg-p12-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n08-s06/instruction.md b/tasks/agg-p12-n08-s06/instruction.md index aad332f1fb6e8e8c81b09b86bbbdb88e339f2b43..484d040f8eb4d2ae4796aeef5cfb0918ac7f0782 100644 --- a/tasks/agg-p12-n08-s06/instruction.md +++ b/tasks/agg-p12-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n08-s06/tests/test.sh b/tasks/agg-p12-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n08-s06/tests/test.sh +++ b/tasks/agg-p12-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n08-s07/instruction.md b/tasks/agg-p12-n08-s07/instruction.md index 27a8e1bd50be0cdbb7d7c6e5b7370ea7a88e7623..1e33aeee51a9a4d728e4588929a0d66b9457a8bb 100644 --- a/tasks/agg-p12-n08-s07/instruction.md +++ b/tasks/agg-p12-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n08-s07/tests/test.sh b/tasks/agg-p12-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n08-s07/tests/test.sh +++ b/tasks/agg-p12-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n08-s08/instruction.md b/tasks/agg-p12-n08-s08/instruction.md index 1069c5f3cbcf0e06c5b92f0ca4c7a088d295f7f6..e106315c611ef4700a50c108ef96a7b8f7be3406 100644 --- a/tasks/agg-p12-n08-s08/instruction.md +++ b/tasks/agg-p12-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n08-s08/tests/test.sh b/tasks/agg-p12-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n08-s08/tests/test.sh +++ b/tasks/agg-p12-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n12-s01/instruction.md b/tasks/agg-p12-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..afc44302e5446bbcbad60907a837f2fdde13fc15 --- /dev/null +++ b/tasks/agg-p12-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n12-s01/solution/solve.sh b/tasks/agg-p12-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f72b0ccd2254215c29e7877254840678513b475 --- /dev/null +++ b/tasks/agg-p12-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n12-s01/task.toml b/tasks/agg-p12-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6993271c8d5b74ec77f482e07a441738ad029959 --- /dev/null +++ b/tasks/agg-p12-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n12-s01/tests/expected.json b/tasks/agg-p12-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..be89a5638575327a84dddf825562e1759af6df54 --- /dev/null +++ b/tasks/agg-p12-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99] diff --git a/tasks/agg-p12-n12-s01/tests/test.sh b/tasks/agg-p12-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n12-s02/instruction.md b/tasks/agg-p12-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..15ed18a1ca8a56a1480af89c847dcd1fab959a55 --- /dev/null +++ b/tasks/agg-p12-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n12-s02/solution/solve.sh b/tasks/agg-p12-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f72b0ccd2254215c29e7877254840678513b475 --- /dev/null +++ b/tasks/agg-p12-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n12-s02/task.toml b/tasks/agg-p12-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ef1bf9e4aaf95a44a01abbcd9ce2bbfca9bbd7a2 --- /dev/null +++ b/tasks/agg-p12-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n12-s02/tests/expected.json b/tasks/agg-p12-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..be89a5638575327a84dddf825562e1759af6df54 --- /dev/null +++ b/tasks/agg-p12-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99] diff --git a/tasks/agg-p12-n12-s02/tests/test.sh b/tasks/agg-p12-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n12-s03/instruction.md b/tasks/agg-p12-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f5aa8b70f2f447fb84dd6b26d80c8d7537bebefb --- /dev/null +++ b/tasks/agg-p12-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n12-s03/solution/solve.sh b/tasks/agg-p12-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f72b0ccd2254215c29e7877254840678513b475 --- /dev/null +++ b/tasks/agg-p12-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n12-s03/task.toml b/tasks/agg-p12-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f1cd15177d3a5d73d6ab98afe813b6e71f1ae159 --- /dev/null +++ b/tasks/agg-p12-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n12-s03/tests/expected.json b/tasks/agg-p12-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..be89a5638575327a84dddf825562e1759af6df54 --- /dev/null +++ b/tasks/agg-p12-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99] diff --git a/tasks/agg-p12-n12-s03/tests/test.sh b/tasks/agg-p12-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n12-s04/instruction.md b/tasks/agg-p12-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cbefd6b3434fac66c24e06d94b9c3c278b95dbfb --- /dev/null +++ b/tasks/agg-p12-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twelve. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n12-s04/solution/solve.sh b/tasks/agg-p12-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f72b0ccd2254215c29e7877254840678513b475 --- /dev/null +++ b/tasks/agg-p12-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n12-s04/task.toml b/tasks/agg-p12-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4b1d0ea9a27b42fffcdca072a1901ee55933928a --- /dev/null +++ b/tasks/agg-p12-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n12-s04/tests/expected.json b/tasks/agg-p12-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..be89a5638575327a84dddf825562e1759af6df54 --- /dev/null +++ b/tasks/agg-p12-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99] diff --git a/tasks/agg-p12-n12-s04/tests/test.sh b/tasks/agg-p12-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n12-s05/instruction.md b/tasks/agg-p12-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..40f3f7e13cfd3a8040e44274dd1b8429c6804923 --- /dev/null +++ b/tasks/agg-p12-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n12-s05/solution/solve.sh b/tasks/agg-p12-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f72b0ccd2254215c29e7877254840678513b475 --- /dev/null +++ b/tasks/agg-p12-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n12-s05/task.toml b/tasks/agg-p12-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..46583bbd7d482cfa6afaef4dbb3e17139e838a38 --- /dev/null +++ b/tasks/agg-p12-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n12-s05/tests/expected.json b/tasks/agg-p12-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..be89a5638575327a84dddf825562e1759af6df54 --- /dev/null +++ b/tasks/agg-p12-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99] diff --git a/tasks/agg-p12-n12-s05/tests/test.sh b/tasks/agg-p12-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n12-s06/instruction.md b/tasks/agg-p12-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1108fd5c3dfb974655fad089e4918849532b6756 --- /dev/null +++ b/tasks/agg-p12-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n12-s06/solution/solve.sh b/tasks/agg-p12-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f72b0ccd2254215c29e7877254840678513b475 --- /dev/null +++ b/tasks/agg-p12-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n12-s06/task.toml b/tasks/agg-p12-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..67959e77535d083ada8a0a289d5acd2254531104 --- /dev/null +++ b/tasks/agg-p12-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n12-s06/tests/expected.json b/tasks/agg-p12-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..be89a5638575327a84dddf825562e1759af6df54 --- /dev/null +++ b/tasks/agg-p12-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99] diff --git a/tasks/agg-p12-n12-s06/tests/test.sh b/tasks/agg-p12-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n12-s07/instruction.md b/tasks/agg-p12-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bcda533fb0b3407f78cfaf5c16a551ac6f72aead --- /dev/null +++ b/tasks/agg-p12-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n12-s07/solution/solve.sh b/tasks/agg-p12-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f72b0ccd2254215c29e7877254840678513b475 --- /dev/null +++ b/tasks/agg-p12-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n12-s07/task.toml b/tasks/agg-p12-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fe2f70f0037b61255fe54a5b5265ce2163611fbc --- /dev/null +++ b/tasks/agg-p12-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n12-s07/tests/expected.json b/tasks/agg-p12-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..be89a5638575327a84dddf825562e1759af6df54 --- /dev/null +++ b/tasks/agg-p12-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99] diff --git a/tasks/agg-p12-n12-s07/tests/test.sh b/tasks/agg-p12-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n12-s08/instruction.md b/tasks/agg-p12-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5435b7812ef266a4e2ec6b0a93d3c306439294ba --- /dev/null +++ b/tasks/agg-p12-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n12-s08/solution/solve.sh b/tasks/agg-p12-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f72b0ccd2254215c29e7877254840678513b475 --- /dev/null +++ b/tasks/agg-p12-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n12-s08/task.toml b/tasks/agg-p12-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b819e27bf5d0c7c212001c6817f355bbed8f4244 --- /dev/null +++ b/tasks/agg-p12-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n12-s08/tests/expected.json b/tasks/agg-p12-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..be89a5638575327a84dddf825562e1759af6df54 --- /dev/null +++ b/tasks/agg-p12-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99] diff --git a/tasks/agg-p12-n12-s08/tests/test.sh b/tasks/agg-p12-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n12-s09/instruction.md b/tasks/agg-p12-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..743bbc1fd4537e0975bd4083d0616f86374f4dee --- /dev/null +++ b/tasks/agg-p12-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n12-s09/solution/solve.sh b/tasks/agg-p12-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f72b0ccd2254215c29e7877254840678513b475 --- /dev/null +++ b/tasks/agg-p12-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n12-s09/task.toml b/tasks/agg-p12-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0866796e236dbee532d62dc36df909bb4f3326e9 --- /dev/null +++ b/tasks/agg-p12-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n12-s09/tests/expected.json b/tasks/agg-p12-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..be89a5638575327a84dddf825562e1759af6df54 --- /dev/null +++ b/tasks/agg-p12-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99] diff --git a/tasks/agg-p12-n12-s09/tests/test.sh b/tasks/agg-p12-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n12-s10/instruction.md b/tasks/agg-p12-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..60de2988fff25a8c1506580c1ef0e053a02c16f7 --- /dev/null +++ b/tasks/agg-p12-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n12-s10/solution/solve.sh b/tasks/agg-p12-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f72b0ccd2254215c29e7877254840678513b475 --- /dev/null +++ b/tasks/agg-p12-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n12-s10/task.toml b/tasks/agg-p12-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c48e78e67084e43e428aa05e0fb705c930ce0cc2 --- /dev/null +++ b/tasks/agg-p12-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n12-s10/tests/expected.json b/tasks/agg-p12-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..be89a5638575327a84dddf825562e1759af6df54 --- /dev/null +++ b/tasks/agg-p12-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99] diff --git a/tasks/agg-p12-n12-s10/tests/test.sh b/tasks/agg-p12-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n12-s11/instruction.md b/tasks/agg-p12-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5435b7812ef266a4e2ec6b0a93d3c306439294ba --- /dev/null +++ b/tasks/agg-p12-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n12-s11/solution/solve.sh b/tasks/agg-p12-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f72b0ccd2254215c29e7877254840678513b475 --- /dev/null +++ b/tasks/agg-p12-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n12-s11/task.toml b/tasks/agg-p12-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3d80159de388102c2893d53b6869a1c50e732c89 --- /dev/null +++ b/tasks/agg-p12-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n12-s11/tests/expected.json b/tasks/agg-p12-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..be89a5638575327a84dddf825562e1759af6df54 --- /dev/null +++ b/tasks/agg-p12-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99] diff --git a/tasks/agg-p12-n12-s11/tests/test.sh b/tasks/agg-p12-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n12-s12/instruction.md b/tasks/agg-p12-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ac4ab97ac5016f85469b1949304d6955bc5c5cdc --- /dev/null +++ b/tasks/agg-p12-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n12-s12/solution/solve.sh b/tasks/agg-p12-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f72b0ccd2254215c29e7877254840678513b475 --- /dev/null +++ b/tasks/agg-p12-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99]' > "$answer" diff --git a/tasks/agg-p12-n12-s12/task.toml b/tasks/agg-p12-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ad60fe39f7bd1f3e1ddca79f1edb400bb14450f3 --- /dev/null +++ b/tasks/agg-p12-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p12-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 12 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p12-n12-s12/tests/expected.json b/tasks/agg-p12-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..be89a5638575327a84dddf825562e1759af6df54 --- /dev/null +++ b/tasks/agg-p12-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[2, 12, 15, 30, 31, 31, 33, 44, 45, 50, 95, 99] diff --git a/tasks/agg-p12-n12-s12/tests/test.sh b/tasks/agg-p12-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p12-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p12-n16-s01/instruction.md b/tasks/agg-p12-n16-s01/instruction.md index ebbf18dd1885eca56e4b99d9ba0f301603987c59..967cbe42235491e28138a2858f78709704a1bd82 100644 --- a/tasks/agg-p12-n16-s01/instruction.md +++ b/tasks/agg-p12-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s01/tests/test.sh b/tasks/agg-p12-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s01/tests/test.sh +++ b/tasks/agg-p12-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s02/instruction.md b/tasks/agg-p12-n16-s02/instruction.md index 24cae7506709ba17884a6f8faefcffb0fa372426..9945eb9052cf9160c89519b7d1952d5ce19dacf8 100644 --- a/tasks/agg-p12-n16-s02/instruction.md +++ b/tasks/agg-p12-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s02/tests/test.sh b/tasks/agg-p12-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s02/tests/test.sh +++ b/tasks/agg-p12-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s03/instruction.md b/tasks/agg-p12-n16-s03/instruction.md index 961985392d4b99bbc35d52871fb6450061a34bb5..c98bd62598f64ffcd1b51c3b31ced8e3cda7460c 100644 --- a/tasks/agg-p12-n16-s03/instruction.md +++ b/tasks/agg-p12-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s03/tests/test.sh b/tasks/agg-p12-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s03/tests/test.sh +++ b/tasks/agg-p12-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s04/instruction.md b/tasks/agg-p12-n16-s04/instruction.md index 0d9b54e563f9bb163b48be34eb84abe311c00e06..ceda32fde53a1c10e904f97ed076f49abdf1f3a5 100644 --- a/tasks/agg-p12-n16-s04/instruction.md +++ b/tasks/agg-p12-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s04/tests/test.sh b/tasks/agg-p12-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s04/tests/test.sh +++ b/tasks/agg-p12-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s05/instruction.md b/tasks/agg-p12-n16-s05/instruction.md index e5e3f1447d4ff13fe5188dafc1b5104a3c8f0e59..f9fc0a05d4cbd2084dc7f80c349485aae4d72692 100644 --- a/tasks/agg-p12-n16-s05/instruction.md +++ b/tasks/agg-p12-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s05/tests/test.sh b/tasks/agg-p12-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s05/tests/test.sh +++ b/tasks/agg-p12-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s06/instruction.md b/tasks/agg-p12-n16-s06/instruction.md index 6b3716855407e49bd1a2d27bc51b41f58fa7bb68..25ebaaacc5fd550a5645a5bd0d6a6adf1dfebf49 100644 --- a/tasks/agg-p12-n16-s06/instruction.md +++ b/tasks/agg-p12-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s06/tests/test.sh b/tasks/agg-p12-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s06/tests/test.sh +++ b/tasks/agg-p12-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s07/instruction.md b/tasks/agg-p12-n16-s07/instruction.md index 7cf63660731cfb255f4030930d1fa31a717d902f..6dab277b2fabfee8f34045a8f6fb47ac3384734d 100644 --- a/tasks/agg-p12-n16-s07/instruction.md +++ b/tasks/agg-p12-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s07/tests/test.sh b/tasks/agg-p12-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s07/tests/test.sh +++ b/tasks/agg-p12-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s08/instruction.md b/tasks/agg-p12-n16-s08/instruction.md index 1245386f0aba38aec1627364e9a0bdce0b3a3214..7a6abd7e671d0d5e514cf3a081a12822f3e1fa80 100644 --- a/tasks/agg-p12-n16-s08/instruction.md +++ b/tasks/agg-p12-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s08/tests/test.sh b/tasks/agg-p12-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s08/tests/test.sh +++ b/tasks/agg-p12-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s09/instruction.md b/tasks/agg-p12-n16-s09/instruction.md index 03acbc08880291cf4dacc5df318650e9c8d0e519..d9247c4c1b3fb63a80aa5e8b875de2a3f5be1b29 100644 --- a/tasks/agg-p12-n16-s09/instruction.md +++ b/tasks/agg-p12-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s09/tests/test.sh b/tasks/agg-p12-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s09/tests/test.sh +++ b/tasks/agg-p12-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s10/instruction.md b/tasks/agg-p12-n16-s10/instruction.md index a31300409e75190524f2a237c2d0d6348715dc53..106160b98d71014a9eaa408fdaab716f872544a2 100644 --- a/tasks/agg-p12-n16-s10/instruction.md +++ b/tasks/agg-p12-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s10/tests/test.sh b/tasks/agg-p12-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s10/tests/test.sh +++ b/tasks/agg-p12-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s11/instruction.md b/tasks/agg-p12-n16-s11/instruction.md index 1245386f0aba38aec1627364e9a0bdce0b3a3214..7a6abd7e671d0d5e514cf3a081a12822f3e1fa80 100644 --- a/tasks/agg-p12-n16-s11/instruction.md +++ b/tasks/agg-p12-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s11/tests/test.sh b/tasks/agg-p12-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s11/tests/test.sh +++ b/tasks/agg-p12-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s12/instruction.md b/tasks/agg-p12-n16-s12/instruction.md index d92b3c67aa869a2b7ccb0b74ca78af94faae0b02..671a8ab2cae28823934c021dcf645fc4038d0570 100644 --- a/tasks/agg-p12-n16-s12/instruction.md +++ b/tasks/agg-p12-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s12/tests/test.sh b/tasks/agg-p12-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s12/tests/test.sh +++ b/tasks/agg-p12-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s13/instruction.md b/tasks/agg-p12-n16-s13/instruction.md index 951d8309ecd3f9fbcea5726f506c658fa51c95fe..66045864ad601fbe1194d5fcde0a3bfc9fdbc25b 100644 --- a/tasks/agg-p12-n16-s13/instruction.md +++ b/tasks/agg-p12-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s13/tests/test.sh b/tasks/agg-p12-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s13/tests/test.sh +++ b/tasks/agg-p12-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s14/instruction.md b/tasks/agg-p12-n16-s14/instruction.md index 961985392d4b99bbc35d52871fb6450061a34bb5..c98bd62598f64ffcd1b51c3b31ced8e3cda7460c 100644 --- a/tasks/agg-p12-n16-s14/instruction.md +++ b/tasks/agg-p12-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s14/tests/test.sh b/tasks/agg-p12-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s14/tests/test.sh +++ b/tasks/agg-p12-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s15/instruction.md b/tasks/agg-p12-n16-s15/instruction.md index f9807e3dca090e22409202efda192d4a7b9f5ac5..f9190cd6f2d679efa59828aa0ffdff708c0d41ce 100644 --- a/tasks/agg-p12-n16-s15/instruction.md +++ b/tasks/agg-p12-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s15/tests/test.sh b/tasks/agg-p12-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s15/tests/test.sh +++ b/tasks/agg-p12-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p12-n16-s16/instruction.md b/tasks/agg-p12-n16-s16/instruction.md index 0f12c719492f216b9a3df72f8d724b2259725c6d..1d57dd2778af84c781626fc62484b7570c395997 100644 --- a/tasks/agg-p12-n16-s16/instruction.md +++ b/tasks/agg-p12-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p12-n16-s16/tests/test.sh b/tasks/agg-p12-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p12-n16-s16/tests/test.sh +++ b/tasks/agg-p12-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n01-s01/instruction.md b/tasks/agg-p13-n01-s01/instruction.md index 940aa4fd9c95e296b244281d4b422b4c4cbaee3b..9c4a9a880815619624b4731342185eb686d10c52 100644 --- a/tasks/agg-p13-n01-s01/instruction.md +++ b/tasks/agg-p13-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is forty-two. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p13-n01-s01/tests/test.sh b/tasks/agg-p13-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n01-s01/tests/test.sh +++ b/tasks/agg-p13-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n02-s01/instruction.md b/tasks/agg-p13-n02-s01/instruction.md index 16a7ad5e103fe676b00156c5c2864b77ca08d8f9..ff3d5d926524f60581674470c61fa6f19c6edd95 100644 --- a/tasks/agg-p13-n02-s01/instruction.md +++ b/tasks/agg-p13-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n02-s01/tests/test.sh b/tasks/agg-p13-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n02-s01/tests/test.sh +++ b/tasks/agg-p13-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n02-s02/instruction.md b/tasks/agg-p13-n02-s02/instruction.md index b41b3ebb8b1392fe793ddfe26665e02c2f3979ed..ef4f2cecfa82af232306a043943a87c6a27c5373 100644 --- a/tasks/agg-p13-n02-s02/instruction.md +++ b/tasks/agg-p13-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n02-s02/tests/test.sh b/tasks/agg-p13-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n02-s02/tests/test.sh +++ b/tasks/agg-p13-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n04-s01/instruction.md b/tasks/agg-p13-n04-s01/instruction.md index 3373394f5046cd80e37af69e5ba69dd7899b4c7d..820f2060d5876e35fbd1d31e64f5d443a44fed23 100644 --- a/tasks/agg-p13-n04-s01/instruction.md +++ b/tasks/agg-p13-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n04-s01/tests/test.sh b/tasks/agg-p13-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n04-s01/tests/test.sh +++ b/tasks/agg-p13-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n04-s02/instruction.md b/tasks/agg-p13-n04-s02/instruction.md index 9989acbc218f753b3cf2a0c28b48737e8f8c3b52..9c75345c066b2cd303e643afacfdec6be7f1e474 100644 --- a/tasks/agg-p13-n04-s02/instruction.md +++ b/tasks/agg-p13-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n04-s02/tests/test.sh b/tasks/agg-p13-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n04-s02/tests/test.sh +++ b/tasks/agg-p13-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n04-s03/instruction.md b/tasks/agg-p13-n04-s03/instruction.md index af29f7ab0f75076509388fa943bdfb4a4c0a5922..ab45d79ba5bf3f1b2a275dd1a83c78ad159fe742 100644 --- a/tasks/agg-p13-n04-s03/instruction.md +++ b/tasks/agg-p13-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n04-s03/tests/test.sh b/tasks/agg-p13-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n04-s03/tests/test.sh +++ b/tasks/agg-p13-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n04-s04/instruction.md b/tasks/agg-p13-n04-s04/instruction.md index 518119f71fa817d39b1900a6e48df01e55fc0ff6..5d2dfbd80327acec26198cb0af43b7951d5c897f 100644 --- a/tasks/agg-p13-n04-s04/instruction.md +++ b/tasks/agg-p13-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n04-s04/tests/test.sh b/tasks/agg-p13-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n04-s04/tests/test.sh +++ b/tasks/agg-p13-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n06-s01/instruction.md b/tasks/agg-p13-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1c12002f72a0b77c6298506bc17adf43fff45c27 --- /dev/null +++ b/tasks/agg-p13-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n06-s01/solution/solve.sh b/tasks/agg-p13-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bd2d2a333a3a655b30a32f07d37a6ccba6f4b974 --- /dev/null +++ b/tasks/agg-p13-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[42, 47, 48, 56, 61, 78]' > "$answer" diff --git a/tasks/agg-p13-n06-s01/task.toml b/tasks/agg-p13-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0f154056c9d5de2231de87dfd2abf1eaee9c9888 --- /dev/null +++ b/tasks/agg-p13-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n06-s01/tests/expected.json b/tasks/agg-p13-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a432050946c16fba7a30236a1e1f2e4ad2b920cd --- /dev/null +++ b/tasks/agg-p13-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[42, 47, 48, 56, 61, 78] diff --git a/tasks/agg-p13-n06-s01/tests/test.sh b/tasks/agg-p13-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n06-s02/instruction.md b/tasks/agg-p13-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..dcbded2dd49a98d0c30372568e3cdcae52a34893 --- /dev/null +++ b/tasks/agg-p13-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n06-s02/solution/solve.sh b/tasks/agg-p13-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bd2d2a333a3a655b30a32f07d37a6ccba6f4b974 --- /dev/null +++ b/tasks/agg-p13-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[42, 47, 48, 56, 61, 78]' > "$answer" diff --git a/tasks/agg-p13-n06-s02/task.toml b/tasks/agg-p13-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4cb3eaa648321c4680f31a7cc327086b7535f08f --- /dev/null +++ b/tasks/agg-p13-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n06-s02/tests/expected.json b/tasks/agg-p13-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a432050946c16fba7a30236a1e1f2e4ad2b920cd --- /dev/null +++ b/tasks/agg-p13-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[42, 47, 48, 56, 61, 78] diff --git a/tasks/agg-p13-n06-s02/tests/test.sh b/tasks/agg-p13-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n06-s03/instruction.md b/tasks/agg-p13-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8b253fb519682bf626feda0158e30db46a4e6c0f --- /dev/null +++ b/tasks/agg-p13-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n06-s03/solution/solve.sh b/tasks/agg-p13-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bd2d2a333a3a655b30a32f07d37a6ccba6f4b974 --- /dev/null +++ b/tasks/agg-p13-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[42, 47, 48, 56, 61, 78]' > "$answer" diff --git a/tasks/agg-p13-n06-s03/task.toml b/tasks/agg-p13-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8189ec5b0f48b8366bd4c8da9eddefaca81015d7 --- /dev/null +++ b/tasks/agg-p13-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n06-s03/tests/expected.json b/tasks/agg-p13-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a432050946c16fba7a30236a1e1f2e4ad2b920cd --- /dev/null +++ b/tasks/agg-p13-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[42, 47, 48, 56, 61, 78] diff --git a/tasks/agg-p13-n06-s03/tests/test.sh b/tasks/agg-p13-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n06-s04/instruction.md b/tasks/agg-p13-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..051446d50cd8d4de68bb620c5ed19ced7da11cab --- /dev/null +++ b/tasks/agg-p13-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n06-s04/solution/solve.sh b/tasks/agg-p13-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bd2d2a333a3a655b30a32f07d37a6ccba6f4b974 --- /dev/null +++ b/tasks/agg-p13-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[42, 47, 48, 56, 61, 78]' > "$answer" diff --git a/tasks/agg-p13-n06-s04/task.toml b/tasks/agg-p13-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e17b0e45e4706a1d640a92ccbfdbcfb5067d6094 --- /dev/null +++ b/tasks/agg-p13-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n06-s04/tests/expected.json b/tasks/agg-p13-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a432050946c16fba7a30236a1e1f2e4ad2b920cd --- /dev/null +++ b/tasks/agg-p13-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[42, 47, 48, 56, 61, 78] diff --git a/tasks/agg-p13-n06-s04/tests/test.sh b/tasks/agg-p13-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n06-s05/instruction.md b/tasks/agg-p13-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d5edd3b7ba18f4df89def8eb63c1b2ef9f41c039 --- /dev/null +++ b/tasks/agg-p13-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n06-s05/solution/solve.sh b/tasks/agg-p13-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bd2d2a333a3a655b30a32f07d37a6ccba6f4b974 --- /dev/null +++ b/tasks/agg-p13-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[42, 47, 48, 56, 61, 78]' > "$answer" diff --git a/tasks/agg-p13-n06-s05/task.toml b/tasks/agg-p13-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2ddd0f7a906a117b3cc0a31cdda79df2b939b92e --- /dev/null +++ b/tasks/agg-p13-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n06-s05/tests/expected.json b/tasks/agg-p13-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a432050946c16fba7a30236a1e1f2e4ad2b920cd --- /dev/null +++ b/tasks/agg-p13-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[42, 47, 48, 56, 61, 78] diff --git a/tasks/agg-p13-n06-s05/tests/test.sh b/tasks/agg-p13-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n06-s06/instruction.md b/tasks/agg-p13-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..09a35658dbd2e1e7e689d7b85518f885d348b148 --- /dev/null +++ b/tasks/agg-p13-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n06-s06/solution/solve.sh b/tasks/agg-p13-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..bd2d2a333a3a655b30a32f07d37a6ccba6f4b974 --- /dev/null +++ b/tasks/agg-p13-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[42, 47, 48, 56, 61, 78]' > "$answer" diff --git a/tasks/agg-p13-n06-s06/task.toml b/tasks/agg-p13-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..49726be444d489d2c4a98521d9ec02aa56c1c409 --- /dev/null +++ b/tasks/agg-p13-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n06-s06/tests/expected.json b/tasks/agg-p13-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a432050946c16fba7a30236a1e1f2e4ad2b920cd --- /dev/null +++ b/tasks/agg-p13-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[42, 47, 48, 56, 61, 78] diff --git a/tasks/agg-p13-n06-s06/tests/test.sh b/tasks/agg-p13-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n08-s01/instruction.md b/tasks/agg-p13-n08-s01/instruction.md index abe052012c47c96a92679103d572c7262d672e3c..da2b166d66ee441695857294e09303b1a672728b 100644 --- a/tasks/agg-p13-n08-s01/instruction.md +++ b/tasks/agg-p13-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n08-s01/tests/test.sh b/tasks/agg-p13-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n08-s01/tests/test.sh +++ b/tasks/agg-p13-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n08-s02/instruction.md b/tasks/agg-p13-n08-s02/instruction.md index 0ee10142e61d08a5571772c533b83202fd01c84e..1d56cadf04393cae3e1d171ef0b958fbd4a2d7f4 100644 --- a/tasks/agg-p13-n08-s02/instruction.md +++ b/tasks/agg-p13-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n08-s02/tests/test.sh b/tasks/agg-p13-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n08-s02/tests/test.sh +++ b/tasks/agg-p13-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n08-s03/instruction.md b/tasks/agg-p13-n08-s03/instruction.md index 9aeda7c18bda7e04cdb2b969682a97e7b7f2d3d5..c2e03bf5ff942c738d8c8b507766fe8a789de295 100644 --- a/tasks/agg-p13-n08-s03/instruction.md +++ b/tasks/agg-p13-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n08-s03/tests/test.sh b/tasks/agg-p13-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n08-s03/tests/test.sh +++ b/tasks/agg-p13-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n08-s04/instruction.md b/tasks/agg-p13-n08-s04/instruction.md index 40f9146550b33cf06b1d4200b62a15ddaaffce76..88319c076939435d4dc23a2c973a6a077628ef17 100644 --- a/tasks/agg-p13-n08-s04/instruction.md +++ b/tasks/agg-p13-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n08-s04/tests/test.sh b/tasks/agg-p13-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n08-s04/tests/test.sh +++ b/tasks/agg-p13-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n08-s05/instruction.md b/tasks/agg-p13-n08-s05/instruction.md index 18a0c74cfce99ad5836ee2b774dc98589cdf30c9..724a50f59f856193f3ee8ad08d6dc8cb138f3eaf 100644 --- a/tasks/agg-p13-n08-s05/instruction.md +++ b/tasks/agg-p13-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n08-s05/tests/test.sh b/tasks/agg-p13-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n08-s05/tests/test.sh +++ b/tasks/agg-p13-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n08-s06/instruction.md b/tasks/agg-p13-n08-s06/instruction.md index b810f3ad633207707958edc8f4de8aaa3b34f710..10c4fa6f85e4cfe5014a312735a2e0f62a2d3254 100644 --- a/tasks/agg-p13-n08-s06/instruction.md +++ b/tasks/agg-p13-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n08-s06/tests/test.sh b/tasks/agg-p13-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n08-s06/tests/test.sh +++ b/tasks/agg-p13-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n08-s07/instruction.md b/tasks/agg-p13-n08-s07/instruction.md index 629e2ae1c728c40605589960cbd96dae496187c1..90998e7368407ace103b85ca771303d040de423a 100644 --- a/tasks/agg-p13-n08-s07/instruction.md +++ b/tasks/agg-p13-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n08-s07/tests/test.sh b/tasks/agg-p13-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n08-s07/tests/test.sh +++ b/tasks/agg-p13-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n08-s08/instruction.md b/tasks/agg-p13-n08-s08/instruction.md index 629e2ae1c728c40605589960cbd96dae496187c1..90998e7368407ace103b85ca771303d040de423a 100644 --- a/tasks/agg-p13-n08-s08/instruction.md +++ b/tasks/agg-p13-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n08-s08/tests/test.sh b/tasks/agg-p13-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n08-s08/tests/test.sh +++ b/tasks/agg-p13-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n12-s01/instruction.md b/tasks/agg-p13-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..da7e70d7ee5e057eb538e0e3c5524cc8a38d3b93 --- /dev/null +++ b/tasks/agg-p13-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n12-s01/solution/solve.sh b/tasks/agg-p13-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..43fad5c23430814a84f3ed0b851d46d5050b7bdd --- /dev/null +++ b/tasks/agg-p13-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82]' > "$answer" diff --git a/tasks/agg-p13-n12-s01/task.toml b/tasks/agg-p13-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2fefdb785e04caa559dca942d43579868191d4bb --- /dev/null +++ b/tasks/agg-p13-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n12-s01/tests/expected.json b/tasks/agg-p13-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7de907cbe48eb94e01ec3fe0a23003beca6e525d --- /dev/null +++ b/tasks/agg-p13-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82] diff --git a/tasks/agg-p13-n12-s01/tests/test.sh b/tasks/agg-p13-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n12-s02/instruction.md b/tasks/agg-p13-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..054dc42296a82036d581d99f90bd071c5bc61a63 --- /dev/null +++ b/tasks/agg-p13-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n12-s02/solution/solve.sh b/tasks/agg-p13-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..43fad5c23430814a84f3ed0b851d46d5050b7bdd --- /dev/null +++ b/tasks/agg-p13-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82]' > "$answer" diff --git a/tasks/agg-p13-n12-s02/task.toml b/tasks/agg-p13-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a99d64fd87738e8c5142662f6c98f73709716f3c --- /dev/null +++ b/tasks/agg-p13-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n12-s02/tests/expected.json b/tasks/agg-p13-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7de907cbe48eb94e01ec3fe0a23003beca6e525d --- /dev/null +++ b/tasks/agg-p13-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82] diff --git a/tasks/agg-p13-n12-s02/tests/test.sh b/tasks/agg-p13-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n12-s03/instruction.md b/tasks/agg-p13-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c8f325be4d0da26c010644a3007675a0c695c534 --- /dev/null +++ b/tasks/agg-p13-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n12-s03/solution/solve.sh b/tasks/agg-p13-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..43fad5c23430814a84f3ed0b851d46d5050b7bdd --- /dev/null +++ b/tasks/agg-p13-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82]' > "$answer" diff --git a/tasks/agg-p13-n12-s03/task.toml b/tasks/agg-p13-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..10eea87583e4d4e0cdd4fbee8132da462e439688 --- /dev/null +++ b/tasks/agg-p13-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n12-s03/tests/expected.json b/tasks/agg-p13-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7de907cbe48eb94e01ec3fe0a23003beca6e525d --- /dev/null +++ b/tasks/agg-p13-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82] diff --git a/tasks/agg-p13-n12-s03/tests/test.sh b/tasks/agg-p13-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n12-s04/instruction.md b/tasks/agg-p13-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b23cc64451ba67760e7585b5affddf553a657ad0 --- /dev/null +++ b/tasks/agg-p13-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n12-s04/solution/solve.sh b/tasks/agg-p13-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..43fad5c23430814a84f3ed0b851d46d5050b7bdd --- /dev/null +++ b/tasks/agg-p13-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82]' > "$answer" diff --git a/tasks/agg-p13-n12-s04/task.toml b/tasks/agg-p13-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2f9a8a838be131b4897556e7137d124dea689cdc --- /dev/null +++ b/tasks/agg-p13-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n12-s04/tests/expected.json b/tasks/agg-p13-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7de907cbe48eb94e01ec3fe0a23003beca6e525d --- /dev/null +++ b/tasks/agg-p13-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82] diff --git a/tasks/agg-p13-n12-s04/tests/test.sh b/tasks/agg-p13-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n12-s05/instruction.md b/tasks/agg-p13-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cb263587194e13f40f0ac806e2318a121b31d15a --- /dev/null +++ b/tasks/agg-p13-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n12-s05/solution/solve.sh b/tasks/agg-p13-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..43fad5c23430814a84f3ed0b851d46d5050b7bdd --- /dev/null +++ b/tasks/agg-p13-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82]' > "$answer" diff --git a/tasks/agg-p13-n12-s05/task.toml b/tasks/agg-p13-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e177b84473cdd54231a8fdc6175e0ad0a0f52e58 --- /dev/null +++ b/tasks/agg-p13-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n12-s05/tests/expected.json b/tasks/agg-p13-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7de907cbe48eb94e01ec3fe0a23003beca6e525d --- /dev/null +++ b/tasks/agg-p13-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82] diff --git a/tasks/agg-p13-n12-s05/tests/test.sh b/tasks/agg-p13-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n12-s06/instruction.md b/tasks/agg-p13-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2f01a3e73dbd4b8b1058dd60451773afa73f14c7 --- /dev/null +++ b/tasks/agg-p13-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n12-s06/solution/solve.sh b/tasks/agg-p13-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..43fad5c23430814a84f3ed0b851d46d5050b7bdd --- /dev/null +++ b/tasks/agg-p13-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82]' > "$answer" diff --git a/tasks/agg-p13-n12-s06/task.toml b/tasks/agg-p13-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5a8965f30573538f34cf79f2cce50d6e278f7876 --- /dev/null +++ b/tasks/agg-p13-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n12-s06/tests/expected.json b/tasks/agg-p13-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7de907cbe48eb94e01ec3fe0a23003beca6e525d --- /dev/null +++ b/tasks/agg-p13-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82] diff --git a/tasks/agg-p13-n12-s06/tests/test.sh b/tasks/agg-p13-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n12-s07/instruction.md b/tasks/agg-p13-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..afc44302e5446bbcbad60907a837f2fdde13fc15 --- /dev/null +++ b/tasks/agg-p13-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n12-s07/solution/solve.sh b/tasks/agg-p13-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..43fad5c23430814a84f3ed0b851d46d5050b7bdd --- /dev/null +++ b/tasks/agg-p13-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82]' > "$answer" diff --git a/tasks/agg-p13-n12-s07/task.toml b/tasks/agg-p13-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f276521f77c290f59fef8a89ca8d247d2bd9ef4e --- /dev/null +++ b/tasks/agg-p13-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n12-s07/tests/expected.json b/tasks/agg-p13-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7de907cbe48eb94e01ec3fe0a23003beca6e525d --- /dev/null +++ b/tasks/agg-p13-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82] diff --git a/tasks/agg-p13-n12-s07/tests/test.sh b/tasks/agg-p13-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n12-s08/instruction.md b/tasks/agg-p13-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..afc44302e5446bbcbad60907a837f2fdde13fc15 --- /dev/null +++ b/tasks/agg-p13-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n12-s08/solution/solve.sh b/tasks/agg-p13-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..43fad5c23430814a84f3ed0b851d46d5050b7bdd --- /dev/null +++ b/tasks/agg-p13-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82]' > "$answer" diff --git a/tasks/agg-p13-n12-s08/task.toml b/tasks/agg-p13-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e8f6f32765f1b20e478ac4b942e774beef93b032 --- /dev/null +++ b/tasks/agg-p13-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n12-s08/tests/expected.json b/tasks/agg-p13-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7de907cbe48eb94e01ec3fe0a23003beca6e525d --- /dev/null +++ b/tasks/agg-p13-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82] diff --git a/tasks/agg-p13-n12-s08/tests/test.sh b/tasks/agg-p13-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n12-s09/instruction.md b/tasks/agg-p13-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1ec3d2a16079c4d9737f2784ae217eea77d88533 --- /dev/null +++ b/tasks/agg-p13-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n12-s09/solution/solve.sh b/tasks/agg-p13-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..43fad5c23430814a84f3ed0b851d46d5050b7bdd --- /dev/null +++ b/tasks/agg-p13-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82]' > "$answer" diff --git a/tasks/agg-p13-n12-s09/task.toml b/tasks/agg-p13-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cdb9f30401207c1edd6e44feb4aad873b43e451c --- /dev/null +++ b/tasks/agg-p13-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n12-s09/tests/expected.json b/tasks/agg-p13-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7de907cbe48eb94e01ec3fe0a23003beca6e525d --- /dev/null +++ b/tasks/agg-p13-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82] diff --git a/tasks/agg-p13-n12-s09/tests/test.sh b/tasks/agg-p13-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n12-s10/instruction.md b/tasks/agg-p13-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cf78bc234ac7165a12e4210d637bece975cb648e --- /dev/null +++ b/tasks/agg-p13-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n12-s10/solution/solve.sh b/tasks/agg-p13-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..43fad5c23430814a84f3ed0b851d46d5050b7bdd --- /dev/null +++ b/tasks/agg-p13-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82]' > "$answer" diff --git a/tasks/agg-p13-n12-s10/task.toml b/tasks/agg-p13-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4e2f4b1757cb5db0469dc5b77a3e40ea0d926de5 --- /dev/null +++ b/tasks/agg-p13-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n12-s10/tests/expected.json b/tasks/agg-p13-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7de907cbe48eb94e01ec3fe0a23003beca6e525d --- /dev/null +++ b/tasks/agg-p13-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82] diff --git a/tasks/agg-p13-n12-s10/tests/test.sh b/tasks/agg-p13-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n12-s11/instruction.md b/tasks/agg-p13-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f378b007e7f5cf7bb24628ed10ac1fe1824109b7 --- /dev/null +++ b/tasks/agg-p13-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n12-s11/solution/solve.sh b/tasks/agg-p13-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..43fad5c23430814a84f3ed0b851d46d5050b7bdd --- /dev/null +++ b/tasks/agg-p13-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82]' > "$answer" diff --git a/tasks/agg-p13-n12-s11/task.toml b/tasks/agg-p13-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..10cae54b6093274fd4969e8f5bc58d3dfe8b7698 --- /dev/null +++ b/tasks/agg-p13-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n12-s11/tests/expected.json b/tasks/agg-p13-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7de907cbe48eb94e01ec3fe0a23003beca6e525d --- /dev/null +++ b/tasks/agg-p13-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82] diff --git a/tasks/agg-p13-n12-s11/tests/test.sh b/tasks/agg-p13-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n12-s12/instruction.md b/tasks/agg-p13-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..297e7df5ad0e1e0ae0182d7fbd8be00d892a2f7e --- /dev/null +++ b/tasks/agg-p13-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n12-s12/solution/solve.sh b/tasks/agg-p13-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..43fad5c23430814a84f3ed0b851d46d5050b7bdd --- /dev/null +++ b/tasks/agg-p13-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82]' > "$answer" diff --git a/tasks/agg-p13-n12-s12/task.toml b/tasks/agg-p13-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c9238f98b7436eaf6baf3feac52b0c6cb731342e --- /dev/null +++ b/tasks/agg-p13-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p13-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 13 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p13-n12-s12/tests/expected.json b/tasks/agg-p13-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..7de907cbe48eb94e01ec3fe0a23003beca6e525d --- /dev/null +++ b/tasks/agg-p13-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[2, 2, 23, 25, 42, 47, 48, 56, 61, 62, 78, 82] diff --git a/tasks/agg-p13-n12-s12/tests/test.sh b/tasks/agg-p13-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p13-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p13-n16-s01/instruction.md b/tasks/agg-p13-n16-s01/instruction.md index 756b66e7e1661b13390451604d8a217c6028d32d..0d5d43f3e734b37862973953434a82fefb583200 100644 --- a/tasks/agg-p13-n16-s01/instruction.md +++ b/tasks/agg-p13-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s01/tests/test.sh b/tasks/agg-p13-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s01/tests/test.sh +++ b/tasks/agg-p13-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s02/instruction.md b/tasks/agg-p13-n16-s02/instruction.md index bd54876511397bdb80a3c3299556503e1fd15da5..ffc3934425adafa34ada41ff5621db5d0f97a3bb 100644 --- a/tasks/agg-p13-n16-s02/instruction.md +++ b/tasks/agg-p13-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s02/tests/test.sh b/tasks/agg-p13-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s02/tests/test.sh +++ b/tasks/agg-p13-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s03/instruction.md b/tasks/agg-p13-n16-s03/instruction.md index 38e83aee5771fa00d5091767999e55e04acb180b..faf993ab529fff7ee5de3df9b24769934f987d78 100644 --- a/tasks/agg-p13-n16-s03/instruction.md +++ b/tasks/agg-p13-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s03/tests/test.sh b/tasks/agg-p13-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s03/tests/test.sh +++ b/tasks/agg-p13-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s04/instruction.md b/tasks/agg-p13-n16-s04/instruction.md index 72bbb260a72c8a03816a7f046d2bafe5f6b145f2..fe4f0325e372e3a12281df6aa7a7ff5ffc6e5d94 100644 --- a/tasks/agg-p13-n16-s04/instruction.md +++ b/tasks/agg-p13-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s04/tests/test.sh b/tasks/agg-p13-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s04/tests/test.sh +++ b/tasks/agg-p13-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s05/instruction.md b/tasks/agg-p13-n16-s05/instruction.md index b591b84320df9e123e22bd4301725691d49ea0a1..7f4d0ff076a0dba3c67021ed8791edf69a2b7c7b 100644 --- a/tasks/agg-p13-n16-s05/instruction.md +++ b/tasks/agg-p13-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s05/tests/test.sh b/tasks/agg-p13-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s05/tests/test.sh +++ b/tasks/agg-p13-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s06/instruction.md b/tasks/agg-p13-n16-s06/instruction.md index c06c0812a7b7ea5a0caff9ffd07ddd76bc328ac2..769741a0d886c36eda905f6aea67cd579968498f 100644 --- a/tasks/agg-p13-n16-s06/instruction.md +++ b/tasks/agg-p13-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s06/tests/test.sh b/tasks/agg-p13-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s06/tests/test.sh +++ b/tasks/agg-p13-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s07/instruction.md b/tasks/agg-p13-n16-s07/instruction.md index ebbf18dd1885eca56e4b99d9ba0f301603987c59..967cbe42235491e28138a2858f78709704a1bd82 100644 --- a/tasks/agg-p13-n16-s07/instruction.md +++ b/tasks/agg-p13-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s07/tests/test.sh b/tasks/agg-p13-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s07/tests/test.sh +++ b/tasks/agg-p13-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s08/instruction.md b/tasks/agg-p13-n16-s08/instruction.md index ebbf18dd1885eca56e4b99d9ba0f301603987c59..967cbe42235491e28138a2858f78709704a1bd82 100644 --- a/tasks/agg-p13-n16-s08/instruction.md +++ b/tasks/agg-p13-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s08/tests/test.sh b/tasks/agg-p13-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s08/tests/test.sh +++ b/tasks/agg-p13-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s09/instruction.md b/tasks/agg-p13-n16-s09/instruction.md index 07133633c82ade16a43a26c7ec6cacc19d41b3bd..01eccecf7626f9336ce7f443b7b16b6f87314d4c 100644 --- a/tasks/agg-p13-n16-s09/instruction.md +++ b/tasks/agg-p13-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s09/tests/test.sh b/tasks/agg-p13-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s09/tests/test.sh +++ b/tasks/agg-p13-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s10/instruction.md b/tasks/agg-p13-n16-s10/instruction.md index 8719f945164b6c7adba0eec9b9728be32d6bfe5e..10a630b21435ec8e620ae5e83c5dc41b678c1031 100644 --- a/tasks/agg-p13-n16-s10/instruction.md +++ b/tasks/agg-p13-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s10/tests/test.sh b/tasks/agg-p13-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s10/tests/test.sh +++ b/tasks/agg-p13-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s11/instruction.md b/tasks/agg-p13-n16-s11/instruction.md index 81fbf2c2720ed316086419e84cc080153e8dc4cd..2c7e0125bf7b6189a66b80f4f9f491784a6708e4 100644 --- a/tasks/agg-p13-n16-s11/instruction.md +++ b/tasks/agg-p13-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s11/tests/test.sh b/tasks/agg-p13-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s11/tests/test.sh +++ b/tasks/agg-p13-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s12/instruction.md b/tasks/agg-p13-n16-s12/instruction.md index 04c3f6729149d2802728807768786a453bb32941..66fed180f5ece962b8f35828f82d008e1814560f 100644 --- a/tasks/agg-p13-n16-s12/instruction.md +++ b/tasks/agg-p13-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s12/tests/test.sh b/tasks/agg-p13-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s12/tests/test.sh +++ b/tasks/agg-p13-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s13/instruction.md b/tasks/agg-p13-n16-s13/instruction.md index a74f85b07c6b9158e3042c827fbada79d595e8f5..364d02befda9eef167acd079029967edd1989d2b 100644 --- a/tasks/agg-p13-n16-s13/instruction.md +++ b/tasks/agg-p13-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s13/tests/test.sh b/tasks/agg-p13-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s13/tests/test.sh +++ b/tasks/agg-p13-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s14/instruction.md b/tasks/agg-p13-n16-s14/instruction.md index a7f0266a5e6733a93cf24a409665e6e92f793dba..d4d40f859809c8e8513c129e910f96795729f446 100644 --- a/tasks/agg-p13-n16-s14/instruction.md +++ b/tasks/agg-p13-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s14/tests/test.sh b/tasks/agg-p13-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s14/tests/test.sh +++ b/tasks/agg-p13-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s15/instruction.md b/tasks/agg-p13-n16-s15/instruction.md index 0d32baca836c92adef8d08189e020f30d37446a4..acf1e48e00457882cd30e3ee2f445009de15d69b 100644 --- a/tasks/agg-p13-n16-s15/instruction.md +++ b/tasks/agg-p13-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s15/tests/test.sh b/tasks/agg-p13-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s15/tests/test.sh +++ b/tasks/agg-p13-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p13-n16-s16/instruction.md b/tasks/agg-p13-n16-s16/instruction.md index 5a931caf2f59950e949680657e57e512d16ee533..e73e804c423ed11a4e1c56759956f246bcd22e10 100644 --- a/tasks/agg-p13-n16-s16/instruction.md +++ b/tasks/agg-p13-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p13-n16-s16/tests/test.sh b/tasks/agg-p13-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p13-n16-s16/tests/test.sh +++ b/tasks/agg-p13-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n01-s01/instruction.md b/tasks/agg-p14-n01-s01/instruction.md index 3f5c5a8cf74db4c97c8e56d4b5fb4ff1018ed680..7cfb915da9d586f61e122fcf4cf0bc69c9d10c2e 100644 --- a/tasks/agg-p14-n01-s01/instruction.md +++ b/tasks/agg-p14-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is eighty-four. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p14-n01-s01/tests/test.sh b/tasks/agg-p14-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n01-s01/tests/test.sh +++ b/tasks/agg-p14-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n02-s01/instruction.md b/tasks/agg-p14-n02-s01/instruction.md index 498afa487440d15bb8b123d1262f0e5f1b11cb32..a39b532d8b66ec13dff1f78b72c3a88e96092dd0 100644 --- a/tasks/agg-p14-n02-s01/instruction.md +++ b/tasks/agg-p14-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n02-s01/tests/test.sh b/tasks/agg-p14-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n02-s01/tests/test.sh +++ b/tasks/agg-p14-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n02-s02/instruction.md b/tasks/agg-p14-n02-s02/instruction.md index e621302d95daf78f55f398b62ae6ecdb5f7e28d9..bf80304a2907954987822db8ec3f7d1360da29f0 100644 --- a/tasks/agg-p14-n02-s02/instruction.md +++ b/tasks/agg-p14-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n02-s02/tests/test.sh b/tasks/agg-p14-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n02-s02/tests/test.sh +++ b/tasks/agg-p14-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n04-s01/instruction.md b/tasks/agg-p14-n04-s01/instruction.md index 1e0005927fd30585d62f857e454dc88b98e7e051..eb145e3df9928587e5f03aa5bd4306f2a4925171 100644 --- a/tasks/agg-p14-n04-s01/instruction.md +++ b/tasks/agg-p14-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n04-s01/tests/test.sh b/tasks/agg-p14-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n04-s01/tests/test.sh +++ b/tasks/agg-p14-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n04-s02/instruction.md b/tasks/agg-p14-n04-s02/instruction.md index 5701fcd4297e555c8d075e61ef8d9eb6c5faba09..008cc85e1c57c51137ed8a25cde4cfe4f87fd885 100644 --- a/tasks/agg-p14-n04-s02/instruction.md +++ b/tasks/agg-p14-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n04-s02/tests/test.sh b/tasks/agg-p14-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n04-s02/tests/test.sh +++ b/tasks/agg-p14-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n04-s03/instruction.md b/tasks/agg-p14-n04-s03/instruction.md index 26e139695ec67bfa61fe76d01a807b84861131dd..4741f01efe48d7179ee27b35d655e12f960f4257 100644 --- a/tasks/agg-p14-n04-s03/instruction.md +++ b/tasks/agg-p14-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n04-s03/tests/test.sh b/tasks/agg-p14-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n04-s03/tests/test.sh +++ b/tasks/agg-p14-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n04-s04/instruction.md b/tasks/agg-p14-n04-s04/instruction.md index c73578c8e3f0d0f1dada19aa91aa8fa6cc5ce6d9..a00d7ab51cd0d846c5d26f931c8965a4cd858eca 100644 --- a/tasks/agg-p14-n04-s04/instruction.md +++ b/tasks/agg-p14-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n04-s04/tests/test.sh b/tasks/agg-p14-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n04-s04/tests/test.sh +++ b/tasks/agg-p14-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n06-s01/instruction.md b/tasks/agg-p14-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..044902def78d0346c915e551662be15393efe3d7 --- /dev/null +++ b/tasks/agg-p14-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n06-s01/solution/solve.sh b/tasks/agg-p14-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..fa763c8508fcf9946530749514d83095a1451dba --- /dev/null +++ b/tasks/agg-p14-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 29, 44, 49, 53, 84]' > "$answer" diff --git a/tasks/agg-p14-n06-s01/task.toml b/tasks/agg-p14-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8dcc1a616000918add591f769197d0988141bea3 --- /dev/null +++ b/tasks/agg-p14-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n06-s01/tests/expected.json b/tasks/agg-p14-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3b0c6e17409480b530d3e0ed010afb6122e49ab0 --- /dev/null +++ b/tasks/agg-p14-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[25, 29, 44, 49, 53, 84] diff --git a/tasks/agg-p14-n06-s01/tests/test.sh b/tasks/agg-p14-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n06-s02/instruction.md b/tasks/agg-p14-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..322ed0d45d71ea24e9eabf05a063a766fd339124 --- /dev/null +++ b/tasks/agg-p14-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n06-s02/solution/solve.sh b/tasks/agg-p14-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..fa763c8508fcf9946530749514d83095a1451dba --- /dev/null +++ b/tasks/agg-p14-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 29, 44, 49, 53, 84]' > "$answer" diff --git a/tasks/agg-p14-n06-s02/task.toml b/tasks/agg-p14-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7e250376cd1ef3115670c193c9c798355afab321 --- /dev/null +++ b/tasks/agg-p14-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n06-s02/tests/expected.json b/tasks/agg-p14-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3b0c6e17409480b530d3e0ed010afb6122e49ab0 --- /dev/null +++ b/tasks/agg-p14-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[25, 29, 44, 49, 53, 84] diff --git a/tasks/agg-p14-n06-s02/tests/test.sh b/tasks/agg-p14-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n06-s03/instruction.md b/tasks/agg-p14-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..41683d53eabd23245dc8e221e343125f96509cc4 --- /dev/null +++ b/tasks/agg-p14-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n06-s03/solution/solve.sh b/tasks/agg-p14-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..fa763c8508fcf9946530749514d83095a1451dba --- /dev/null +++ b/tasks/agg-p14-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 29, 44, 49, 53, 84]' > "$answer" diff --git a/tasks/agg-p14-n06-s03/task.toml b/tasks/agg-p14-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ac1488b3a1ec8942afb04bb853300952332e4b32 --- /dev/null +++ b/tasks/agg-p14-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n06-s03/tests/expected.json b/tasks/agg-p14-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3b0c6e17409480b530d3e0ed010afb6122e49ab0 --- /dev/null +++ b/tasks/agg-p14-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[25, 29, 44, 49, 53, 84] diff --git a/tasks/agg-p14-n06-s03/tests/test.sh b/tasks/agg-p14-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n06-s04/instruction.md b/tasks/agg-p14-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2acfaa4e57d45dcea9fe594d49bed02d3904ea57 --- /dev/null +++ b/tasks/agg-p14-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n06-s04/solution/solve.sh b/tasks/agg-p14-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..fa763c8508fcf9946530749514d83095a1451dba --- /dev/null +++ b/tasks/agg-p14-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 29, 44, 49, 53, 84]' > "$answer" diff --git a/tasks/agg-p14-n06-s04/task.toml b/tasks/agg-p14-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..db5e78be9b648913ac57f6600900d1e0d1914b6e --- /dev/null +++ b/tasks/agg-p14-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n06-s04/tests/expected.json b/tasks/agg-p14-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3b0c6e17409480b530d3e0ed010afb6122e49ab0 --- /dev/null +++ b/tasks/agg-p14-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[25, 29, 44, 49, 53, 84] diff --git a/tasks/agg-p14-n06-s04/tests/test.sh b/tasks/agg-p14-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n06-s05/instruction.md b/tasks/agg-p14-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6dcbc105c872e1a8124f422226220a38a629c510 --- /dev/null +++ b/tasks/agg-p14-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n06-s05/solution/solve.sh b/tasks/agg-p14-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..fa763c8508fcf9946530749514d83095a1451dba --- /dev/null +++ b/tasks/agg-p14-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 29, 44, 49, 53, 84]' > "$answer" diff --git a/tasks/agg-p14-n06-s05/task.toml b/tasks/agg-p14-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0458f3915317185f41f2d63d8ff0305c60fc4e9b --- /dev/null +++ b/tasks/agg-p14-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n06-s05/tests/expected.json b/tasks/agg-p14-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3b0c6e17409480b530d3e0ed010afb6122e49ab0 --- /dev/null +++ b/tasks/agg-p14-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[25, 29, 44, 49, 53, 84] diff --git a/tasks/agg-p14-n06-s05/tests/test.sh b/tasks/agg-p14-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n06-s06/instruction.md b/tasks/agg-p14-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f9e883bdc9bff7ab7a0b8faee044c945ab0a1ced --- /dev/null +++ b/tasks/agg-p14-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n06-s06/solution/solve.sh b/tasks/agg-p14-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..fa763c8508fcf9946530749514d83095a1451dba --- /dev/null +++ b/tasks/agg-p14-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[25, 29, 44, 49, 53, 84]' > "$answer" diff --git a/tasks/agg-p14-n06-s06/task.toml b/tasks/agg-p14-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e96115cc1e9f0b9708c740ef26e17ec2c09d21fc --- /dev/null +++ b/tasks/agg-p14-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n06-s06/tests/expected.json b/tasks/agg-p14-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3b0c6e17409480b530d3e0ed010afb6122e49ab0 --- /dev/null +++ b/tasks/agg-p14-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[25, 29, 44, 49, 53, 84] diff --git a/tasks/agg-p14-n06-s06/tests/test.sh b/tasks/agg-p14-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n08-s01/instruction.md b/tasks/agg-p14-n08-s01/instruction.md index 6662e6911ad1105e195cbc6e76b3cc8d9854bef3..d4b85483dd2dae073bb973b1851f38367afa7271 100644 --- a/tasks/agg-p14-n08-s01/instruction.md +++ b/tasks/agg-p14-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n08-s01/tests/test.sh b/tasks/agg-p14-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n08-s01/tests/test.sh +++ b/tasks/agg-p14-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n08-s02/instruction.md b/tasks/agg-p14-n08-s02/instruction.md index efc3ca50863310e063ca355ec298707c5d0b6577..930e16568b7a7b54406f16dfc7820ceead9e77f8 100644 --- a/tasks/agg-p14-n08-s02/instruction.md +++ b/tasks/agg-p14-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n08-s02/tests/test.sh b/tasks/agg-p14-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n08-s02/tests/test.sh +++ b/tasks/agg-p14-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n08-s03/instruction.md b/tasks/agg-p14-n08-s03/instruction.md index fb0fbc43bc72c36371a3de146c4ffbb7a4304417..838413aa41b8e4bf70f97dc35ce6f9f74b85f116 100644 --- a/tasks/agg-p14-n08-s03/instruction.md +++ b/tasks/agg-p14-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n08-s03/tests/test.sh b/tasks/agg-p14-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n08-s03/tests/test.sh +++ b/tasks/agg-p14-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n08-s04/instruction.md b/tasks/agg-p14-n08-s04/instruction.md index 2977a346481de4a6052c0959cd91ba095dded4f4..6d88546e49edb41e682170da4fc85e4b71f8a6c7 100644 --- a/tasks/agg-p14-n08-s04/instruction.md +++ b/tasks/agg-p14-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n08-s04/tests/test.sh b/tasks/agg-p14-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n08-s04/tests/test.sh +++ b/tasks/agg-p14-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n08-s05/instruction.md b/tasks/agg-p14-n08-s05/instruction.md index fde113c01e4acfbeb8da7ffabf1e13aba553efcb..88ddcffb3959c9bd9103a75fdec6a10918b46528 100644 --- a/tasks/agg-p14-n08-s05/instruction.md +++ b/tasks/agg-p14-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n08-s05/tests/test.sh b/tasks/agg-p14-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n08-s05/tests/test.sh +++ b/tasks/agg-p14-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n08-s06/instruction.md b/tasks/agg-p14-n08-s06/instruction.md index eee7a0b5f66fc3863f0f9be834031a101d16805b..e18ab9027af739e0c6a8e15c489ac72b51badfe0 100644 --- a/tasks/agg-p14-n08-s06/instruction.md +++ b/tasks/agg-p14-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n08-s06/tests/test.sh b/tasks/agg-p14-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n08-s06/tests/test.sh +++ b/tasks/agg-p14-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n08-s07/instruction.md b/tasks/agg-p14-n08-s07/instruction.md index b64a92e68353b9fc7a1f0fe39017de53c567f828..1908c1b4282d9c79f275510c40f0c40d5bc73072 100644 --- a/tasks/agg-p14-n08-s07/instruction.md +++ b/tasks/agg-p14-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n08-s07/tests/test.sh b/tasks/agg-p14-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n08-s07/tests/test.sh +++ b/tasks/agg-p14-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n08-s08/instruction.md b/tasks/agg-p14-n08-s08/instruction.md index f4e65040a18e282edb2a2adba3d140edc730a8fb..2abf5c28a47a3f21e2537d3eb9534454af889323 100644 --- a/tasks/agg-p14-n08-s08/instruction.md +++ b/tasks/agg-p14-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n08-s08/tests/test.sh b/tasks/agg-p14-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n08-s08/tests/test.sh +++ b/tasks/agg-p14-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n12-s01/instruction.md b/tasks/agg-p14-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..50b917cf08b6446450c1a43541739f4d5c2745bd --- /dev/null +++ b/tasks/agg-p14-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n12-s01/solution/solve.sh b/tasks/agg-p14-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e1fb4f53683ba78552f1be0732629493bbb7bce --- /dev/null +++ b/tasks/agg-p14-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96]' > "$answer" diff --git a/tasks/agg-p14-n12-s01/task.toml b/tasks/agg-p14-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..042c3b301dd4b70a5f1a586bd5a9a86774137009 --- /dev/null +++ b/tasks/agg-p14-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n12-s01/tests/expected.json b/tasks/agg-p14-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..cdd98fa2393c3cfe14d70acdc4bee27cdf35f714 --- /dev/null +++ b/tasks/agg-p14-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96] diff --git a/tasks/agg-p14-n12-s01/tests/test.sh b/tasks/agg-p14-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n12-s02/instruction.md b/tasks/agg-p14-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..03f9f9dd05581a99b586e1b1b2b4801743fafb2d --- /dev/null +++ b/tasks/agg-p14-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n12-s02/solution/solve.sh b/tasks/agg-p14-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e1fb4f53683ba78552f1be0732629493bbb7bce --- /dev/null +++ b/tasks/agg-p14-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96]' > "$answer" diff --git a/tasks/agg-p14-n12-s02/task.toml b/tasks/agg-p14-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ec8a2879d1f2e586da7c864c4b322ee0baed6ca9 --- /dev/null +++ b/tasks/agg-p14-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n12-s02/tests/expected.json b/tasks/agg-p14-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..cdd98fa2393c3cfe14d70acdc4bee27cdf35f714 --- /dev/null +++ b/tasks/agg-p14-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96] diff --git a/tasks/agg-p14-n12-s02/tests/test.sh b/tasks/agg-p14-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n12-s03/instruction.md b/tasks/agg-p14-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..619b52b72dd0e0fb5294f24176b256347b8b4527 --- /dev/null +++ b/tasks/agg-p14-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n12-s03/solution/solve.sh b/tasks/agg-p14-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e1fb4f53683ba78552f1be0732629493bbb7bce --- /dev/null +++ b/tasks/agg-p14-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96]' > "$answer" diff --git a/tasks/agg-p14-n12-s03/task.toml b/tasks/agg-p14-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8ad02e21fc822001990dcc7088f316add3bf8754 --- /dev/null +++ b/tasks/agg-p14-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n12-s03/tests/expected.json b/tasks/agg-p14-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..cdd98fa2393c3cfe14d70acdc4bee27cdf35f714 --- /dev/null +++ b/tasks/agg-p14-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96] diff --git a/tasks/agg-p14-n12-s03/tests/test.sh b/tasks/agg-p14-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n12-s04/instruction.md b/tasks/agg-p14-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a9ae9019b7ad29e5cdcfd17fa8d4d8750dfb4c89 --- /dev/null +++ b/tasks/agg-p14-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n12-s04/solution/solve.sh b/tasks/agg-p14-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e1fb4f53683ba78552f1be0732629493bbb7bce --- /dev/null +++ b/tasks/agg-p14-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96]' > "$answer" diff --git a/tasks/agg-p14-n12-s04/task.toml b/tasks/agg-p14-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..41e7b6f7c8dc14b5af0421a0b3e308e4ddc7cd43 --- /dev/null +++ b/tasks/agg-p14-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n12-s04/tests/expected.json b/tasks/agg-p14-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..cdd98fa2393c3cfe14d70acdc4bee27cdf35f714 --- /dev/null +++ b/tasks/agg-p14-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96] diff --git a/tasks/agg-p14-n12-s04/tests/test.sh b/tasks/agg-p14-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n12-s05/instruction.md b/tasks/agg-p14-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..60de2988fff25a8c1506580c1ef0e053a02c16f7 --- /dev/null +++ b/tasks/agg-p14-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n12-s05/solution/solve.sh b/tasks/agg-p14-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e1fb4f53683ba78552f1be0732629493bbb7bce --- /dev/null +++ b/tasks/agg-p14-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96]' > "$answer" diff --git a/tasks/agg-p14-n12-s05/task.toml b/tasks/agg-p14-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..31edc0f1408f635136e6f3955efb8d0dd3d89ac7 --- /dev/null +++ b/tasks/agg-p14-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n12-s05/tests/expected.json b/tasks/agg-p14-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..cdd98fa2393c3cfe14d70acdc4bee27cdf35f714 --- /dev/null +++ b/tasks/agg-p14-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96] diff --git a/tasks/agg-p14-n12-s05/tests/test.sh b/tasks/agg-p14-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n12-s06/instruction.md b/tasks/agg-p14-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..297e7df5ad0e1e0ae0182d7fbd8be00d892a2f7e --- /dev/null +++ b/tasks/agg-p14-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n12-s06/solution/solve.sh b/tasks/agg-p14-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e1fb4f53683ba78552f1be0732629493bbb7bce --- /dev/null +++ b/tasks/agg-p14-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96]' > "$answer" diff --git a/tasks/agg-p14-n12-s06/task.toml b/tasks/agg-p14-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8e6cb55c526ba4eb27b7b5f4d8bbcdae2cef9a29 --- /dev/null +++ b/tasks/agg-p14-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n12-s06/tests/expected.json b/tasks/agg-p14-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..cdd98fa2393c3cfe14d70acdc4bee27cdf35f714 --- /dev/null +++ b/tasks/agg-p14-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96] diff --git a/tasks/agg-p14-n12-s06/tests/test.sh b/tasks/agg-p14-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n12-s07/instruction.md b/tasks/agg-p14-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..aea24c74bafba54585041b7cfc69f546eb8451cd --- /dev/null +++ b/tasks/agg-p14-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n12-s07/solution/solve.sh b/tasks/agg-p14-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e1fb4f53683ba78552f1be0732629493bbb7bce --- /dev/null +++ b/tasks/agg-p14-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96]' > "$answer" diff --git a/tasks/agg-p14-n12-s07/task.toml b/tasks/agg-p14-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a63bf20ec705eef9e871c77819b9d4e7d84047aa --- /dev/null +++ b/tasks/agg-p14-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n12-s07/tests/expected.json b/tasks/agg-p14-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..cdd98fa2393c3cfe14d70acdc4bee27cdf35f714 --- /dev/null +++ b/tasks/agg-p14-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96] diff --git a/tasks/agg-p14-n12-s07/tests/test.sh b/tasks/agg-p14-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n12-s08/instruction.md b/tasks/agg-p14-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e2d2cc8e9bcc9cde703e8c6628f5b3a2b4377585 --- /dev/null +++ b/tasks/agg-p14-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n12-s08/solution/solve.sh b/tasks/agg-p14-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e1fb4f53683ba78552f1be0732629493bbb7bce --- /dev/null +++ b/tasks/agg-p14-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96]' > "$answer" diff --git a/tasks/agg-p14-n12-s08/task.toml b/tasks/agg-p14-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5055fdc6648eef1f967ad48e2b58a2264b56a498 --- /dev/null +++ b/tasks/agg-p14-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n12-s08/tests/expected.json b/tasks/agg-p14-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..cdd98fa2393c3cfe14d70acdc4bee27cdf35f714 --- /dev/null +++ b/tasks/agg-p14-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96] diff --git a/tasks/agg-p14-n12-s08/tests/test.sh b/tasks/agg-p14-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n12-s09/instruction.md b/tasks/agg-p14-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..94b2bafb52358803774fef0f96566ce593de1b99 --- /dev/null +++ b/tasks/agg-p14-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n12-s09/solution/solve.sh b/tasks/agg-p14-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e1fb4f53683ba78552f1be0732629493bbb7bce --- /dev/null +++ b/tasks/agg-p14-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96]' > "$answer" diff --git a/tasks/agg-p14-n12-s09/task.toml b/tasks/agg-p14-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0b26d4581d407e88a2c4fc5e0bf9e7bd1d513d34 --- /dev/null +++ b/tasks/agg-p14-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n12-s09/tests/expected.json b/tasks/agg-p14-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..cdd98fa2393c3cfe14d70acdc4bee27cdf35f714 --- /dev/null +++ b/tasks/agg-p14-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96] diff --git a/tasks/agg-p14-n12-s09/tests/test.sh b/tasks/agg-p14-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n12-s10/instruction.md b/tasks/agg-p14-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..93227a000a0fade57df7be54fe716ccf440f5a17 --- /dev/null +++ b/tasks/agg-p14-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n12-s10/solution/solve.sh b/tasks/agg-p14-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e1fb4f53683ba78552f1be0732629493bbb7bce --- /dev/null +++ b/tasks/agg-p14-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96]' > "$answer" diff --git a/tasks/agg-p14-n12-s10/task.toml b/tasks/agg-p14-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..254bc5f84feba1a8ee1db0f098f44d8d5f928ff7 --- /dev/null +++ b/tasks/agg-p14-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n12-s10/tests/expected.json b/tasks/agg-p14-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..cdd98fa2393c3cfe14d70acdc4bee27cdf35f714 --- /dev/null +++ b/tasks/agg-p14-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96] diff --git a/tasks/agg-p14-n12-s10/tests/test.sh b/tasks/agg-p14-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n12-s11/instruction.md b/tasks/agg-p14-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..054dc42296a82036d581d99f90bd071c5bc61a63 --- /dev/null +++ b/tasks/agg-p14-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n12-s11/solution/solve.sh b/tasks/agg-p14-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e1fb4f53683ba78552f1be0732629493bbb7bce --- /dev/null +++ b/tasks/agg-p14-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96]' > "$answer" diff --git a/tasks/agg-p14-n12-s11/task.toml b/tasks/agg-p14-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4b5180ec8ac2ed290d82b9a3cbe50b56f1ae115b --- /dev/null +++ b/tasks/agg-p14-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n12-s11/tests/expected.json b/tasks/agg-p14-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..cdd98fa2393c3cfe14d70acdc4bee27cdf35f714 --- /dev/null +++ b/tasks/agg-p14-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96] diff --git a/tasks/agg-p14-n12-s11/tests/test.sh b/tasks/agg-p14-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n12-s12/instruction.md b/tasks/agg-p14-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..858fd908139109c01cfa1d8e481e4eba9092e0b5 --- /dev/null +++ b/tasks/agg-p14-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n12-s12/solution/solve.sh b/tasks/agg-p14-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8e1fb4f53683ba78552f1be0732629493bbb7bce --- /dev/null +++ b/tasks/agg-p14-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96]' > "$answer" diff --git a/tasks/agg-p14-n12-s12/task.toml b/tasks/agg-p14-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c15569d0c306f13e0df5d2a906e81f4007434041 --- /dev/null +++ b/tasks/agg-p14-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p14-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 14 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p14-n12-s12/tests/expected.json b/tasks/agg-p14-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..cdd98fa2393c3cfe14d70acdc4bee27cdf35f714 --- /dev/null +++ b/tasks/agg-p14-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[1, 25, 29, 39, 44, 49, 53, 59, 72, 78, 84, 96] diff --git a/tasks/agg-p14-n12-s12/tests/test.sh b/tasks/agg-p14-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p14-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p14-n16-s01/instruction.md b/tasks/agg-p14-n16-s01/instruction.md index 7d5ca093d11da3b866f85566039dbc2ac3bc8c84..7fe87dfffe4ad85e98cdbb07e05a77bf8a912afc 100644 --- a/tasks/agg-p14-n16-s01/instruction.md +++ b/tasks/agg-p14-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s01/tests/test.sh b/tasks/agg-p14-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s01/tests/test.sh +++ b/tasks/agg-p14-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s02/instruction.md b/tasks/agg-p14-n16-s02/instruction.md index 4256e6220fcaf944c5b8d19997e2ebfa14df1a3a..d942fe902e8c9e013e140b297a8130029e959c2e 100644 --- a/tasks/agg-p14-n16-s02/instruction.md +++ b/tasks/agg-p14-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s02/tests/test.sh b/tasks/agg-p14-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s02/tests/test.sh +++ b/tasks/agg-p14-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s03/instruction.md b/tasks/agg-p14-n16-s03/instruction.md index d019999eecd81b0d102088ffd8dc6702e314773f..0800edc3b640ede26ab3978765dad5c40d1446ad 100644 --- a/tasks/agg-p14-n16-s03/instruction.md +++ b/tasks/agg-p14-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s03/tests/test.sh b/tasks/agg-p14-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s03/tests/test.sh +++ b/tasks/agg-p14-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s04/instruction.md b/tasks/agg-p14-n16-s04/instruction.md index 8e07e4d36fb62c2d2904ca839b34d4b0744c309f..e4175fb2ee970049448cc7af46e926ef2e770c0c 100644 --- a/tasks/agg-p14-n16-s04/instruction.md +++ b/tasks/agg-p14-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s04/tests/test.sh b/tasks/agg-p14-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s04/tests/test.sh +++ b/tasks/agg-p14-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s05/instruction.md b/tasks/agg-p14-n16-s05/instruction.md index a31300409e75190524f2a237c2d0d6348715dc53..106160b98d71014a9eaa408fdaab716f872544a2 100644 --- a/tasks/agg-p14-n16-s05/instruction.md +++ b/tasks/agg-p14-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s05/tests/test.sh b/tasks/agg-p14-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s05/tests/test.sh +++ b/tasks/agg-p14-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s06/instruction.md b/tasks/agg-p14-n16-s06/instruction.md index 04c3f6729149d2802728807768786a453bb32941..66fed180f5ece962b8f35828f82d008e1814560f 100644 --- a/tasks/agg-p14-n16-s06/instruction.md +++ b/tasks/agg-p14-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s06/tests/test.sh b/tasks/agg-p14-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s06/tests/test.sh +++ b/tasks/agg-p14-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s07/instruction.md b/tasks/agg-p14-n16-s07/instruction.md index 955b43d84b811b75405d52e1370487f6c7c7cb98..ddc7baf69b4eb80e25b3b08db2dfc6aa651b8b0b 100644 --- a/tasks/agg-p14-n16-s07/instruction.md +++ b/tasks/agg-p14-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s07/tests/test.sh b/tasks/agg-p14-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s07/tests/test.sh +++ b/tasks/agg-p14-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s08/instruction.md b/tasks/agg-p14-n16-s08/instruction.md index d443699990b373083b3fdeb1d846a400fde6e65b..b08879079fe0758b0792198b043d2a59e2a911e2 100644 --- a/tasks/agg-p14-n16-s08/instruction.md +++ b/tasks/agg-p14-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s08/tests/test.sh b/tasks/agg-p14-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s08/tests/test.sh +++ b/tasks/agg-p14-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s09/instruction.md b/tasks/agg-p14-n16-s09/instruction.md index 9e673d50df3d0049f8ebbc5f08e69f16f929b38f..f17a373aff362de5ccbc3d2752a0dc99bf30605b 100644 --- a/tasks/agg-p14-n16-s09/instruction.md +++ b/tasks/agg-p14-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s09/tests/test.sh b/tasks/agg-p14-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s09/tests/test.sh +++ b/tasks/agg-p14-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s10/instruction.md b/tasks/agg-p14-n16-s10/instruction.md index 08f16c0341c376d61759335375d8e966ef70afb6..b1c2f8c471e4497bc3b40e61a030f9c69cc7f8d2 100644 --- a/tasks/agg-p14-n16-s10/instruction.md +++ b/tasks/agg-p14-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s10/tests/test.sh b/tasks/agg-p14-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s10/tests/test.sh +++ b/tasks/agg-p14-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s11/instruction.md b/tasks/agg-p14-n16-s11/instruction.md index bd54876511397bdb80a3c3299556503e1fd15da5..ffc3934425adafa34ada41ff5621db5d0f97a3bb 100644 --- a/tasks/agg-p14-n16-s11/instruction.md +++ b/tasks/agg-p14-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s11/tests/test.sh b/tasks/agg-p14-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s11/tests/test.sh +++ b/tasks/agg-p14-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s12/instruction.md b/tasks/agg-p14-n16-s12/instruction.md index 1a86ea7323aad3c91f00b65904f038f7e58f852d..d90a1687d9e29b3017d6bfd726c776fc6eece866 100644 --- a/tasks/agg-p14-n16-s12/instruction.md +++ b/tasks/agg-p14-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s12/tests/test.sh b/tasks/agg-p14-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s12/tests/test.sh +++ b/tasks/agg-p14-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s13/instruction.md b/tasks/agg-p14-n16-s13/instruction.md index 10bcc3d169e35738b1fb80abb7316f9cd7c1b230..254a759d5a0113deb55448c366676577f275a1f1 100644 --- a/tasks/agg-p14-n16-s13/instruction.md +++ b/tasks/agg-p14-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s13/tests/test.sh b/tasks/agg-p14-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s13/tests/test.sh +++ b/tasks/agg-p14-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s14/instruction.md b/tasks/agg-p14-n16-s14/instruction.md index fb03ade0279ecf776a2ba0e785bd133ee36ecac6..3a629248b9ad5c45b818dd2ecd91107928508549 100644 --- a/tasks/agg-p14-n16-s14/instruction.md +++ b/tasks/agg-p14-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s14/tests/test.sh b/tasks/agg-p14-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s14/tests/test.sh +++ b/tasks/agg-p14-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s15/instruction.md b/tasks/agg-p14-n16-s15/instruction.md index 03acbc08880291cf4dacc5df318650e9c8d0e519..d9247c4c1b3fb63a80aa5e8b875de2a3f5be1b29 100644 --- a/tasks/agg-p14-n16-s15/instruction.md +++ b/tasks/agg-p14-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s15/tests/test.sh b/tasks/agg-p14-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s15/tests/test.sh +++ b/tasks/agg-p14-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p14-n16-s16/instruction.md b/tasks/agg-p14-n16-s16/instruction.md index 0f12c719492f216b9a3df72f8d724b2259725c6d..1d57dd2778af84c781626fc62484b7570c395997 100644 --- a/tasks/agg-p14-n16-s16/instruction.md +++ b/tasks/agg-p14-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p14-n16-s16/tests/test.sh b/tasks/agg-p14-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p14-n16-s16/tests/test.sh +++ b/tasks/agg-p14-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n01-s01/instruction.md b/tasks/agg-p15-n01-s01/instruction.md index 8b183a410f6784b4c2401e33f3404029ba45b663..cfe0a5390fb2b6a15328ff2764e870f0aedbbb24 100644 --- a/tasks/agg-p15-n01-s01/instruction.md +++ b/tasks/agg-p15-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is thirty-seven. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p15-n01-s01/tests/test.sh b/tasks/agg-p15-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n01-s01/tests/test.sh +++ b/tasks/agg-p15-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n02-s01/instruction.md b/tasks/agg-p15-n02-s01/instruction.md index a0f5d6312615f15532c609835c393db0d12fe574..60942ac5c12598ab8f5115caa263a4e08a18a959 100644 --- a/tasks/agg-p15-n02-s01/instruction.md +++ b/tasks/agg-p15-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n02-s01/tests/test.sh b/tasks/agg-p15-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n02-s01/tests/test.sh +++ b/tasks/agg-p15-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n02-s02/instruction.md b/tasks/agg-p15-n02-s02/instruction.md index e621302d95daf78f55f398b62ae6ecdb5f7e28d9..bf80304a2907954987822db8ec3f7d1360da29f0 100644 --- a/tasks/agg-p15-n02-s02/instruction.md +++ b/tasks/agg-p15-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n02-s02/tests/test.sh b/tasks/agg-p15-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n02-s02/tests/test.sh +++ b/tasks/agg-p15-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n04-s01/instruction.md b/tasks/agg-p15-n04-s01/instruction.md index e277410d31e98e54fee347c8344a718ced81e639..a341ab49f244ade6a8766079f432438a2111a896 100644 --- a/tasks/agg-p15-n04-s01/instruction.md +++ b/tasks/agg-p15-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n04-s01/tests/test.sh b/tasks/agg-p15-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n04-s01/tests/test.sh +++ b/tasks/agg-p15-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n04-s02/instruction.md b/tasks/agg-p15-n04-s02/instruction.md index 5701fcd4297e555c8d075e61ef8d9eb6c5faba09..008cc85e1c57c51137ed8a25cde4cfe4f87fd885 100644 --- a/tasks/agg-p15-n04-s02/instruction.md +++ b/tasks/agg-p15-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n04-s02/tests/test.sh b/tasks/agg-p15-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n04-s02/tests/test.sh +++ b/tasks/agg-p15-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n04-s03/instruction.md b/tasks/agg-p15-n04-s03/instruction.md index 35d1afd72cf600540907b19cc7d078cb47d28575..8618ca7ba6b2772a607c481c7f8b5a903ba8794b 100644 --- a/tasks/agg-p15-n04-s03/instruction.md +++ b/tasks/agg-p15-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n04-s03/tests/test.sh b/tasks/agg-p15-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n04-s03/tests/test.sh +++ b/tasks/agg-p15-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n04-s04/instruction.md b/tasks/agg-p15-n04-s04/instruction.md index 634df09d93ffa8b0d27ad435c23fa0756ccec488..6bfd9c04bcf1227beed07e89eb749d849e806b0e 100644 --- a/tasks/agg-p15-n04-s04/instruction.md +++ b/tasks/agg-p15-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n04-s04/tests/test.sh b/tasks/agg-p15-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n04-s04/tests/test.sh +++ b/tasks/agg-p15-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n06-s01/instruction.md b/tasks/agg-p15-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b24b39ec78a0cf7e450c5ad8eba4aa7d5a4a5b36 --- /dev/null +++ b/tasks/agg-p15-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n06-s01/solution/solve.sh b/tasks/agg-p15-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c1b3bf7003a0244f9648a4fbca05b26fb4e5fbb8 --- /dev/null +++ b/tasks/agg-p15-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 37, 49, 57, 79]' > "$answer" diff --git a/tasks/agg-p15-n06-s01/task.toml b/tasks/agg-p15-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2ae4949585ba35a046a6c9e2f3cfe186a98463b1 --- /dev/null +++ b/tasks/agg-p15-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n06-s01/tests/expected.json b/tasks/agg-p15-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..8458daa247ad473907380dd010a2e3970a0054d1 --- /dev/null +++ b/tasks/agg-p15-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 37, 49, 57, 79] diff --git a/tasks/agg-p15-n06-s01/tests/test.sh b/tasks/agg-p15-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n06-s02/instruction.md b/tasks/agg-p15-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..322ed0d45d71ea24e9eabf05a063a766fd339124 --- /dev/null +++ b/tasks/agg-p15-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n06-s02/solution/solve.sh b/tasks/agg-p15-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c1b3bf7003a0244f9648a4fbca05b26fb4e5fbb8 --- /dev/null +++ b/tasks/agg-p15-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 37, 49, 57, 79]' > "$answer" diff --git a/tasks/agg-p15-n06-s02/task.toml b/tasks/agg-p15-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..23c3afbfdba7c86d2e49a982247d6fa6ab55738c --- /dev/null +++ b/tasks/agg-p15-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n06-s02/tests/expected.json b/tasks/agg-p15-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..8458daa247ad473907380dd010a2e3970a0054d1 --- /dev/null +++ b/tasks/agg-p15-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 37, 49, 57, 79] diff --git a/tasks/agg-p15-n06-s02/tests/test.sh b/tasks/agg-p15-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n06-s03/instruction.md b/tasks/agg-p15-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..28b2e9647b1848ba7e1eabdb72052ac17b1ace6c --- /dev/null +++ b/tasks/agg-p15-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n06-s03/solution/solve.sh b/tasks/agg-p15-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c1b3bf7003a0244f9648a4fbca05b26fb4e5fbb8 --- /dev/null +++ b/tasks/agg-p15-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 37, 49, 57, 79]' > "$answer" diff --git a/tasks/agg-p15-n06-s03/task.toml b/tasks/agg-p15-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2f8e056f149c2e756cd20ed3089c0bb3500ad009 --- /dev/null +++ b/tasks/agg-p15-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n06-s03/tests/expected.json b/tasks/agg-p15-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..8458daa247ad473907380dd010a2e3970a0054d1 --- /dev/null +++ b/tasks/agg-p15-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 37, 49, 57, 79] diff --git a/tasks/agg-p15-n06-s03/tests/test.sh b/tasks/agg-p15-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n06-s04/instruction.md b/tasks/agg-p15-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..04cf285aad86357cf317bf42bc4d056ca047a35f --- /dev/null +++ b/tasks/agg-p15-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighteen. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n06-s04/solution/solve.sh b/tasks/agg-p15-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c1b3bf7003a0244f9648a4fbca05b26fb4e5fbb8 --- /dev/null +++ b/tasks/agg-p15-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 37, 49, 57, 79]' > "$answer" diff --git a/tasks/agg-p15-n06-s04/task.toml b/tasks/agg-p15-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f2c9cdc40ca5442d627c066a2f378b16c7d7627f --- /dev/null +++ b/tasks/agg-p15-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n06-s04/tests/expected.json b/tasks/agg-p15-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..8458daa247ad473907380dd010a2e3970a0054d1 --- /dev/null +++ b/tasks/agg-p15-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 37, 49, 57, 79] diff --git a/tasks/agg-p15-n06-s04/tests/test.sh b/tasks/agg-p15-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n06-s05/instruction.md b/tasks/agg-p15-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2acfaa4e57d45dcea9fe594d49bed02d3904ea57 --- /dev/null +++ b/tasks/agg-p15-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n06-s05/solution/solve.sh b/tasks/agg-p15-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c1b3bf7003a0244f9648a4fbca05b26fb4e5fbb8 --- /dev/null +++ b/tasks/agg-p15-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 37, 49, 57, 79]' > "$answer" diff --git a/tasks/agg-p15-n06-s05/task.toml b/tasks/agg-p15-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e1ec1305c1bfda3abfab4650b1e1dc3c8efd9827 --- /dev/null +++ b/tasks/agg-p15-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n06-s05/tests/expected.json b/tasks/agg-p15-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..8458daa247ad473907380dd010a2e3970a0054d1 --- /dev/null +++ b/tasks/agg-p15-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 37, 49, 57, 79] diff --git a/tasks/agg-p15-n06-s05/tests/test.sh b/tasks/agg-p15-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n06-s06/instruction.md b/tasks/agg-p15-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..69d7d5fa36cbcf249bb2f709999ee0ae1aba7eca --- /dev/null +++ b/tasks/agg-p15-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n06-s06/solution/solve.sh b/tasks/agg-p15-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..c1b3bf7003a0244f9648a4fbca05b26fb4e5fbb8 --- /dev/null +++ b/tasks/agg-p15-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 37, 49, 57, 79]' > "$answer" diff --git a/tasks/agg-p15-n06-s06/task.toml b/tasks/agg-p15-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..554cf5dc3a06bdd210b8143f7a6e561b3db6155f --- /dev/null +++ b/tasks/agg-p15-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n06-s06/tests/expected.json b/tasks/agg-p15-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..8458daa247ad473907380dd010a2e3970a0054d1 --- /dev/null +++ b/tasks/agg-p15-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 37, 49, 57, 79] diff --git a/tasks/agg-p15-n06-s06/tests/test.sh b/tasks/agg-p15-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n08-s01/instruction.md b/tasks/agg-p15-n08-s01/instruction.md index d28771240990d9554944b9ef68d9203e0acd7f13..99290acfb8baa2927750e2841040ecf9ddb5f1fa 100644 --- a/tasks/agg-p15-n08-s01/instruction.md +++ b/tasks/agg-p15-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n08-s01/tests/test.sh b/tasks/agg-p15-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n08-s01/tests/test.sh +++ b/tasks/agg-p15-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n08-s02/instruction.md b/tasks/agg-p15-n08-s02/instruction.md index efc3ca50863310e063ca355ec298707c5d0b6577..930e16568b7a7b54406f16dfc7820ceead9e77f8 100644 --- a/tasks/agg-p15-n08-s02/instruction.md +++ b/tasks/agg-p15-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n08-s02/tests/test.sh b/tasks/agg-p15-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n08-s02/tests/test.sh +++ b/tasks/agg-p15-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n08-s03/instruction.md b/tasks/agg-p15-n08-s03/instruction.md index 2d60bbf6673a6be4cd68c1d77ed23a488a7bf7bf..9ba01c27661d4440f16d9001c644bd0a79960e2c 100644 --- a/tasks/agg-p15-n08-s03/instruction.md +++ b/tasks/agg-p15-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n08-s03/tests/test.sh b/tasks/agg-p15-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n08-s03/tests/test.sh +++ b/tasks/agg-p15-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n08-s04/instruction.md b/tasks/agg-p15-n08-s04/instruction.md index 6c99d3a421a7820e0d5105d7dbdbfe39b5c15b23..eac777563a00a423c4b9e27422d5202e95928f87 100644 --- a/tasks/agg-p15-n08-s04/instruction.md +++ b/tasks/agg-p15-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n08-s04/tests/test.sh b/tasks/agg-p15-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n08-s04/tests/test.sh +++ b/tasks/agg-p15-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n08-s05/instruction.md b/tasks/agg-p15-n08-s05/instruction.md index 2977a346481de4a6052c0959cd91ba095dded4f4..6d88546e49edb41e682170da4fc85e4b71f8a6c7 100644 --- a/tasks/agg-p15-n08-s05/instruction.md +++ b/tasks/agg-p15-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n08-s05/tests/test.sh b/tasks/agg-p15-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n08-s05/tests/test.sh +++ b/tasks/agg-p15-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n08-s06/instruction.md b/tasks/agg-p15-n08-s06/instruction.md index d356bb5ea0ea3378245500692d3d1b5cb41a9db4..5cb171c56a05b0aca43138d82992e7a971af7c0e 100644 --- a/tasks/agg-p15-n08-s06/instruction.md +++ b/tasks/agg-p15-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n08-s06/tests/test.sh b/tasks/agg-p15-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n08-s06/tests/test.sh +++ b/tasks/agg-p15-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n08-s07/instruction.md b/tasks/agg-p15-n08-s07/instruction.md index 3e2cf199d0c7560bff5db95d105fc3d398218b9b..1851aafed962daf32119d5a471e50c234bb89b71 100644 --- a/tasks/agg-p15-n08-s07/instruction.md +++ b/tasks/agg-p15-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n08-s07/tests/test.sh b/tasks/agg-p15-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n08-s07/tests/test.sh +++ b/tasks/agg-p15-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n08-s08/instruction.md b/tasks/agg-p15-n08-s08/instruction.md index 1479c41de00fbbd2d26aad2aee1e7ce486083215..0112dc65c46753b81674029d63466bce37601f3f 100644 --- a/tasks/agg-p15-n08-s08/instruction.md +++ b/tasks/agg-p15-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n08-s08/tests/test.sh b/tasks/agg-p15-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n08-s08/tests/test.sh +++ b/tasks/agg-p15-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n12-s01/instruction.md b/tasks/agg-p15-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f8a7f84dc10e74d2d1efa1c93d0465b237cf01e --- /dev/null +++ b/tasks/agg-p15-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n12-s01/solution/solve.sh b/tasks/agg-p15-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d7299c7b529b72ae678a212c6bc10d6c0ded43f6 --- /dev/null +++ b/tasks/agg-p15-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79]' > "$answer" diff --git a/tasks/agg-p15-n12-s01/task.toml b/tasks/agg-p15-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..23bc35a08605cacf8c36acd67bc4682b2f004506 --- /dev/null +++ b/tasks/agg-p15-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n12-s01/tests/expected.json b/tasks/agg-p15-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..aedee258106856741cdb9f22eab223a57fea48d7 --- /dev/null +++ b/tasks/agg-p15-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79] diff --git a/tasks/agg-p15-n12-s01/tests/test.sh b/tasks/agg-p15-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n12-s02/instruction.md b/tasks/agg-p15-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..03f9f9dd05581a99b586e1b1b2b4801743fafb2d --- /dev/null +++ b/tasks/agg-p15-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n12-s02/solution/solve.sh b/tasks/agg-p15-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d7299c7b529b72ae678a212c6bc10d6c0ded43f6 --- /dev/null +++ b/tasks/agg-p15-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79]' > "$answer" diff --git a/tasks/agg-p15-n12-s02/task.toml b/tasks/agg-p15-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..761aa319f3df2d9a0e504812884b994e59008cb1 --- /dev/null +++ b/tasks/agg-p15-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n12-s02/tests/expected.json b/tasks/agg-p15-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..aedee258106856741cdb9f22eab223a57fea48d7 --- /dev/null +++ b/tasks/agg-p15-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79] diff --git a/tasks/agg-p15-n12-s02/tests/test.sh b/tasks/agg-p15-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n12-s03/instruction.md b/tasks/agg-p15-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2d2551d3f0f60676e1ee34e7c12f21100d6a7d1d --- /dev/null +++ b/tasks/agg-p15-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n12-s03/solution/solve.sh b/tasks/agg-p15-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d7299c7b529b72ae678a212c6bc10d6c0ded43f6 --- /dev/null +++ b/tasks/agg-p15-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79]' > "$answer" diff --git a/tasks/agg-p15-n12-s03/task.toml b/tasks/agg-p15-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..13984da45e6f782ef8aa52e91099a03c19771915 --- /dev/null +++ b/tasks/agg-p15-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n12-s03/tests/expected.json b/tasks/agg-p15-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..aedee258106856741cdb9f22eab223a57fea48d7 --- /dev/null +++ b/tasks/agg-p15-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79] diff --git a/tasks/agg-p15-n12-s03/tests/test.sh b/tasks/agg-p15-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n12-s04/instruction.md b/tasks/agg-p15-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bc6ecc07cf5acdcd085bd56b2102f26cc68f534e --- /dev/null +++ b/tasks/agg-p15-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n12-s04/solution/solve.sh b/tasks/agg-p15-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d7299c7b529b72ae678a212c6bc10d6c0ded43f6 --- /dev/null +++ b/tasks/agg-p15-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79]' > "$answer" diff --git a/tasks/agg-p15-n12-s04/task.toml b/tasks/agg-p15-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..09c03b19e75f2f9c3d762d2427fcb121b146f366 --- /dev/null +++ b/tasks/agg-p15-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n12-s04/tests/expected.json b/tasks/agg-p15-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..aedee258106856741cdb9f22eab223a57fea48d7 --- /dev/null +++ b/tasks/agg-p15-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79] diff --git a/tasks/agg-p15-n12-s04/tests/test.sh b/tasks/agg-p15-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n12-s05/instruction.md b/tasks/agg-p15-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a9ae9019b7ad29e5cdcfd17fa8d4d8750dfb4c89 --- /dev/null +++ b/tasks/agg-p15-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n12-s05/solution/solve.sh b/tasks/agg-p15-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d7299c7b529b72ae678a212c6bc10d6c0ded43f6 --- /dev/null +++ b/tasks/agg-p15-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79]' > "$answer" diff --git a/tasks/agg-p15-n12-s05/task.toml b/tasks/agg-p15-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..01b5b8a044ca1737bee2d3cd785cdd670335af5e --- /dev/null +++ b/tasks/agg-p15-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n12-s05/tests/expected.json b/tasks/agg-p15-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..aedee258106856741cdb9f22eab223a57fea48d7 --- /dev/null +++ b/tasks/agg-p15-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79] diff --git a/tasks/agg-p15-n12-s05/tests/test.sh b/tasks/agg-p15-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n12-s06/instruction.md b/tasks/agg-p15-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d78566c7957cbe8132af56f4888ef6e81649dcb3 --- /dev/null +++ b/tasks/agg-p15-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n12-s06/solution/solve.sh b/tasks/agg-p15-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d7299c7b529b72ae678a212c6bc10d6c0ded43f6 --- /dev/null +++ b/tasks/agg-p15-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79]' > "$answer" diff --git a/tasks/agg-p15-n12-s06/task.toml b/tasks/agg-p15-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..85418a49642680cf89eb58a106cb1cbba2ba767f --- /dev/null +++ b/tasks/agg-p15-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n12-s06/tests/expected.json b/tasks/agg-p15-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..aedee258106856741cdb9f22eab223a57fea48d7 --- /dev/null +++ b/tasks/agg-p15-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79] diff --git a/tasks/agg-p15-n12-s06/tests/test.sh b/tasks/agg-p15-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n12-s07/instruction.md b/tasks/agg-p15-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..15ed18a1ca8a56a1480af89c847dcd1fab959a55 --- /dev/null +++ b/tasks/agg-p15-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n12-s07/solution/solve.sh b/tasks/agg-p15-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d7299c7b529b72ae678a212c6bc10d6c0ded43f6 --- /dev/null +++ b/tasks/agg-p15-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79]' > "$answer" diff --git a/tasks/agg-p15-n12-s07/task.toml b/tasks/agg-p15-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..830a30781f1ece7eeae763fb76e23d8abd5106a2 --- /dev/null +++ b/tasks/agg-p15-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n12-s07/tests/expected.json b/tasks/agg-p15-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..aedee258106856741cdb9f22eab223a57fea48d7 --- /dev/null +++ b/tasks/agg-p15-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79] diff --git a/tasks/agg-p15-n12-s07/tests/test.sh b/tasks/agg-p15-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n12-s08/instruction.md b/tasks/agg-p15-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f378b007e7f5cf7bb24628ed10ac1fe1824109b7 --- /dev/null +++ b/tasks/agg-p15-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n12-s08/solution/solve.sh b/tasks/agg-p15-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d7299c7b529b72ae678a212c6bc10d6c0ded43f6 --- /dev/null +++ b/tasks/agg-p15-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79]' > "$answer" diff --git a/tasks/agg-p15-n12-s08/task.toml b/tasks/agg-p15-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c3e81c84506e1dbbd85457826480a54525e4ec68 --- /dev/null +++ b/tasks/agg-p15-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n12-s08/tests/expected.json b/tasks/agg-p15-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..aedee258106856741cdb9f22eab223a57fea48d7 --- /dev/null +++ b/tasks/agg-p15-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79] diff --git a/tasks/agg-p15-n12-s08/tests/test.sh b/tasks/agg-p15-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n12-s09/instruction.md b/tasks/agg-p15-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..619b52b72dd0e0fb5294f24176b256347b8b4527 --- /dev/null +++ b/tasks/agg-p15-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n12-s09/solution/solve.sh b/tasks/agg-p15-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d7299c7b529b72ae678a212c6bc10d6c0ded43f6 --- /dev/null +++ b/tasks/agg-p15-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79]' > "$answer" diff --git a/tasks/agg-p15-n12-s09/task.toml b/tasks/agg-p15-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5a48f0985a525d1b3f071c2456b1d88ebd4d74bd --- /dev/null +++ b/tasks/agg-p15-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n12-s09/tests/expected.json b/tasks/agg-p15-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..aedee258106856741cdb9f22eab223a57fea48d7 --- /dev/null +++ b/tasks/agg-p15-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79] diff --git a/tasks/agg-p15-n12-s09/tests/test.sh b/tasks/agg-p15-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n12-s10/instruction.md b/tasks/agg-p15-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1108fd5c3dfb974655fad089e4918849532b6756 --- /dev/null +++ b/tasks/agg-p15-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n12-s10/solution/solve.sh b/tasks/agg-p15-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d7299c7b529b72ae678a212c6bc10d6c0ded43f6 --- /dev/null +++ b/tasks/agg-p15-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79]' > "$answer" diff --git a/tasks/agg-p15-n12-s10/task.toml b/tasks/agg-p15-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..736e8e8550b69386bcd6cf5568e367bf4ea07b91 --- /dev/null +++ b/tasks/agg-p15-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n12-s10/tests/expected.json b/tasks/agg-p15-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..aedee258106856741cdb9f22eab223a57fea48d7 --- /dev/null +++ b/tasks/agg-p15-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79] diff --git a/tasks/agg-p15-n12-s10/tests/test.sh b/tasks/agg-p15-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n12-s11/instruction.md b/tasks/agg-p15-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..894c08d452dd150a471307a3b982c78b62f7152f --- /dev/null +++ b/tasks/agg-p15-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n12-s11/solution/solve.sh b/tasks/agg-p15-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d7299c7b529b72ae678a212c6bc10d6c0ded43f6 --- /dev/null +++ b/tasks/agg-p15-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79]' > "$answer" diff --git a/tasks/agg-p15-n12-s11/task.toml b/tasks/agg-p15-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..faf6c2dcdede6ee4a0859c4478fad92097779ead --- /dev/null +++ b/tasks/agg-p15-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n12-s11/tests/expected.json b/tasks/agg-p15-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..aedee258106856741cdb9f22eab223a57fea48d7 --- /dev/null +++ b/tasks/agg-p15-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79] diff --git a/tasks/agg-p15-n12-s11/tests/test.sh b/tasks/agg-p15-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n12-s12/instruction.md b/tasks/agg-p15-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1108fd5c3dfb974655fad089e4918849532b6756 --- /dev/null +++ b/tasks/agg-p15-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n12-s12/solution/solve.sh b/tasks/agg-p15-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d7299c7b529b72ae678a212c6bc10d6c0ded43f6 --- /dev/null +++ b/tasks/agg-p15-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79]' > "$answer" diff --git a/tasks/agg-p15-n12-s12/task.toml b/tasks/agg-p15-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..becc3b69bef77c18cb590166e9abeae8f2fe1de3 --- /dev/null +++ b/tasks/agg-p15-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p15-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 15 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p15-n12-s12/tests/expected.json b/tasks/agg-p15-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..aedee258106856741cdb9f22eab223a57fea48d7 --- /dev/null +++ b/tasks/agg-p15-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[18, 29, 30, 30, 37, 43, 49, 50, 53, 57, 62, 79] diff --git a/tasks/agg-p15-n12-s12/tests/test.sh b/tasks/agg-p15-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p15-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p15-n16-s01/instruction.md b/tasks/agg-p15-n16-s01/instruction.md index 10bcc3d169e35738b1fb80abb7316f9cd7c1b230..254a759d5a0113deb55448c366676577f275a1f1 100644 --- a/tasks/agg-p15-n16-s01/instruction.md +++ b/tasks/agg-p15-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s01/tests/test.sh b/tasks/agg-p15-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s01/tests/test.sh +++ b/tasks/agg-p15-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s02/instruction.md b/tasks/agg-p15-n16-s02/instruction.md index 4256e6220fcaf944c5b8d19997e2ebfa14df1a3a..d942fe902e8c9e013e140b297a8130029e959c2e 100644 --- a/tasks/agg-p15-n16-s02/instruction.md +++ b/tasks/agg-p15-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s02/tests/test.sh b/tasks/agg-p15-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s02/tests/test.sh +++ b/tasks/agg-p15-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s03/instruction.md b/tasks/agg-p15-n16-s03/instruction.md index 842ab62762da159702eecd05bee6231e50b04d8f..3585f20798dad91576432b94fc5446156ebc4cbd 100644 --- a/tasks/agg-p15-n16-s03/instruction.md +++ b/tasks/agg-p15-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s03/tests/test.sh b/tasks/agg-p15-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s03/tests/test.sh +++ b/tasks/agg-p15-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s04/instruction.md b/tasks/agg-p15-n16-s04/instruction.md index 57c62f85ec1ef4f9ca9aa899d016621c4b04432a..e1bd267ed9ac9c4fbf94870756f771be1265779a 100644 --- a/tasks/agg-p15-n16-s04/instruction.md +++ b/tasks/agg-p15-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s04/tests/test.sh b/tasks/agg-p15-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s04/tests/test.sh +++ b/tasks/agg-p15-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s05/instruction.md b/tasks/agg-p15-n16-s05/instruction.md index 8e07e4d36fb62c2d2904ca839b34d4b0744c309f..e4175fb2ee970049448cc7af46e926ef2e770c0c 100644 --- a/tasks/agg-p15-n16-s05/instruction.md +++ b/tasks/agg-p15-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s05/tests/test.sh b/tasks/agg-p15-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s05/tests/test.sh +++ b/tasks/agg-p15-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s06/instruction.md b/tasks/agg-p15-n16-s06/instruction.md index f9807e3dca090e22409202efda192d4a7b9f5ac5..f9190cd6f2d679efa59828aa0ffdff708c0d41ce 100644 --- a/tasks/agg-p15-n16-s06/instruction.md +++ b/tasks/agg-p15-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s06/tests/test.sh b/tasks/agg-p15-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s06/tests/test.sh +++ b/tasks/agg-p15-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s07/instruction.md b/tasks/agg-p15-n16-s07/instruction.md index 24cae7506709ba17884a6f8faefcffb0fa372426..9945eb9052cf9160c89519b7d1952d5ce19dacf8 100644 --- a/tasks/agg-p15-n16-s07/instruction.md +++ b/tasks/agg-p15-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s07/tests/test.sh b/tasks/agg-p15-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s07/tests/test.sh +++ b/tasks/agg-p15-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s08/instruction.md b/tasks/agg-p15-n16-s08/instruction.md index 81fbf2c2720ed316086419e84cc080153e8dc4cd..2c7e0125bf7b6189a66b80f4f9f491784a6708e4 100644 --- a/tasks/agg-p15-n16-s08/instruction.md +++ b/tasks/agg-p15-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s08/tests/test.sh b/tasks/agg-p15-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s08/tests/test.sh +++ b/tasks/agg-p15-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s09/instruction.md b/tasks/agg-p15-n16-s09/instruction.md index d019999eecd81b0d102088ffd8dc6702e314773f..0800edc3b640ede26ab3978765dad5c40d1446ad 100644 --- a/tasks/agg-p15-n16-s09/instruction.md +++ b/tasks/agg-p15-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s09/tests/test.sh b/tasks/agg-p15-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s09/tests/test.sh +++ b/tasks/agg-p15-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s10/instruction.md b/tasks/agg-p15-n16-s10/instruction.md index 6b3716855407e49bd1a2d27bc51b41f58fa7bb68..25ebaaacc5fd550a5645a5bd0d6a6adf1dfebf49 100644 --- a/tasks/agg-p15-n16-s10/instruction.md +++ b/tasks/agg-p15-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s10/tests/test.sh b/tasks/agg-p15-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s10/tests/test.sh +++ b/tasks/agg-p15-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s11/instruction.md b/tasks/agg-p15-n16-s11/instruction.md index c0f9d178a1c3057c8c4b57e9c5eca4e4c625b138..efa987bc861271d3fcd4cc6f1530e4d2ecbb6990 100644 --- a/tasks/agg-p15-n16-s11/instruction.md +++ b/tasks/agg-p15-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s11/tests/test.sh b/tasks/agg-p15-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s11/tests/test.sh +++ b/tasks/agg-p15-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s12/instruction.md b/tasks/agg-p15-n16-s12/instruction.md index 6b3716855407e49bd1a2d27bc51b41f58fa7bb68..25ebaaacc5fd550a5645a5bd0d6a6adf1dfebf49 100644 --- a/tasks/agg-p15-n16-s12/instruction.md +++ b/tasks/agg-p15-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s12/tests/test.sh b/tasks/agg-p15-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s12/tests/test.sh +++ b/tasks/agg-p15-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s13/instruction.md b/tasks/agg-p15-n16-s13/instruction.md index bd54876511397bdb80a3c3299556503e1fd15da5..ffc3934425adafa34ada41ff5621db5d0f97a3bb 100644 --- a/tasks/agg-p15-n16-s13/instruction.md +++ b/tasks/agg-p15-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s13/tests/test.sh b/tasks/agg-p15-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s13/tests/test.sh +++ b/tasks/agg-p15-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s14/instruction.md b/tasks/agg-p15-n16-s14/instruction.md index 8719f945164b6c7adba0eec9b9728be32d6bfe5e..10a630b21435ec8e620ae5e83c5dc41b678c1031 100644 --- a/tasks/agg-p15-n16-s14/instruction.md +++ b/tasks/agg-p15-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s14/tests/test.sh b/tasks/agg-p15-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s14/tests/test.sh +++ b/tasks/agg-p15-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s15/instruction.md b/tasks/agg-p15-n16-s15/instruction.md index d43b73fdfa99ecf2128fbcfe0de8040bb73fcb09..b12e192c283828cd14f2785cf454be268f90f5d0 100644 --- a/tasks/agg-p15-n16-s15/instruction.md +++ b/tasks/agg-p15-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s15/tests/test.sh b/tasks/agg-p15-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s15/tests/test.sh +++ b/tasks/agg-p15-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p15-n16-s16/instruction.md b/tasks/agg-p15-n16-s16/instruction.md index ebe30196b058cfe81ab8a53dd5461649bcf91202..7078e28d54452ae1cab8849d4648225bf8c92be9 100644 --- a/tasks/agg-p15-n16-s16/instruction.md +++ b/tasks/agg-p15-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p15-n16-s16/tests/test.sh b/tasks/agg-p15-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p15-n16-s16/tests/test.sh +++ b/tasks/agg-p15-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n01-s01/instruction.md b/tasks/agg-p16-n01-s01/instruction.md index 081cdcd2558354d5a9dcdf31186c1ebb939837bb..94ff02550105597cf7d874ed3ad7e1e25f43b5d9 100644 --- a/tasks/agg-p16-n01-s01/instruction.md +++ b/tasks/agg-p16-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is thirty-eight. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p16-n01-s01/tests/test.sh b/tasks/agg-p16-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n01-s01/tests/test.sh +++ b/tasks/agg-p16-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n02-s01/instruction.md b/tasks/agg-p16-n02-s01/instruction.md index cb87db73d5bf4b2b31ccc1f58a80a87e4a213982..01dc6b51bcdb9a6d3ad1578e70885e475daa8043 100644 --- a/tasks/agg-p16-n02-s01/instruction.md +++ b/tasks/agg-p16-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n02-s01/tests/test.sh b/tasks/agg-p16-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n02-s01/tests/test.sh +++ b/tasks/agg-p16-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n02-s02/instruction.md b/tasks/agg-p16-n02-s02/instruction.md index 9e0c0e14fe4d55d7b54e581c40fc99adbf21d0ad..7c5ceca35d2a9cf45efe327fdfe53345274c811b 100644 --- a/tasks/agg-p16-n02-s02/instruction.md +++ b/tasks/agg-p16-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n02-s02/tests/test.sh b/tasks/agg-p16-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n02-s02/tests/test.sh +++ b/tasks/agg-p16-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n04-s01/instruction.md b/tasks/agg-p16-n04-s01/instruction.md index 2fdd036d16482b9a65a4c12fbd6caac1b69095a8..f08e560b5d0e23c56ad897635078a6f7f241dd05 100644 --- a/tasks/agg-p16-n04-s01/instruction.md +++ b/tasks/agg-p16-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n04-s01/tests/test.sh b/tasks/agg-p16-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n04-s01/tests/test.sh +++ b/tasks/agg-p16-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n04-s02/instruction.md b/tasks/agg-p16-n04-s02/instruction.md index 21738d8281fbf6f79920c8f899c7b62fd63a1f69..fc05372928276dae0d170df7e4773692b35ea17c 100644 --- a/tasks/agg-p16-n04-s02/instruction.md +++ b/tasks/agg-p16-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n04-s02/tests/test.sh b/tasks/agg-p16-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n04-s02/tests/test.sh +++ b/tasks/agg-p16-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n04-s03/instruction.md b/tasks/agg-p16-n04-s03/instruction.md index e934d5b81564b688edeee6d62528269684911274..11bfdabb39b566931f1768f908b92f89e5aef8a3 100644 --- a/tasks/agg-p16-n04-s03/instruction.md +++ b/tasks/agg-p16-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n04-s03/tests/test.sh b/tasks/agg-p16-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n04-s03/tests/test.sh +++ b/tasks/agg-p16-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n04-s04/instruction.md b/tasks/agg-p16-n04-s04/instruction.md index 21738d8281fbf6f79920c8f899c7b62fd63a1f69..fc05372928276dae0d170df7e4773692b35ea17c 100644 --- a/tasks/agg-p16-n04-s04/instruction.md +++ b/tasks/agg-p16-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n04-s04/tests/test.sh b/tasks/agg-p16-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n04-s04/tests/test.sh +++ b/tasks/agg-p16-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n06-s01/instruction.md b/tasks/agg-p16-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a0391fdc0975cceaca695a17de8d8a49acb4f08d --- /dev/null +++ b/tasks/agg-p16-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n06-s01/solution/solve.sh b/tasks/agg-p16-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..76ed52fe5a57e509d04294164921760364e5b7cf --- /dev/null +++ b/tasks/agg-p16-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[30, 38, 51, 63, 63, 78]' > "$answer" diff --git a/tasks/agg-p16-n06-s01/task.toml b/tasks/agg-p16-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..99ecea35e50f4fe808d318635b5045ea688a3a95 --- /dev/null +++ b/tasks/agg-p16-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n06-s01/tests/expected.json b/tasks/agg-p16-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..97f29dfdb1c42f60a6b1d1cc6337bbae85778ae0 --- /dev/null +++ b/tasks/agg-p16-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[30, 38, 51, 63, 63, 78] diff --git a/tasks/agg-p16-n06-s01/tests/test.sh b/tasks/agg-p16-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n06-s02/instruction.md b/tasks/agg-p16-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0eb696327e075f8b7979003c950d443e8610306a --- /dev/null +++ b/tasks/agg-p16-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n06-s02/solution/solve.sh b/tasks/agg-p16-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..76ed52fe5a57e509d04294164921760364e5b7cf --- /dev/null +++ b/tasks/agg-p16-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[30, 38, 51, 63, 63, 78]' > "$answer" diff --git a/tasks/agg-p16-n06-s02/task.toml b/tasks/agg-p16-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bb2b610482059f90b323faacbff527cf7a7294d1 --- /dev/null +++ b/tasks/agg-p16-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n06-s02/tests/expected.json b/tasks/agg-p16-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..97f29dfdb1c42f60a6b1d1cc6337bbae85778ae0 --- /dev/null +++ b/tasks/agg-p16-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[30, 38, 51, 63, 63, 78] diff --git a/tasks/agg-p16-n06-s02/tests/test.sh b/tasks/agg-p16-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n06-s03/instruction.md b/tasks/agg-p16-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bf829d764393493c37754d5c1b4044cbd52f94a7 --- /dev/null +++ b/tasks/agg-p16-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n06-s03/solution/solve.sh b/tasks/agg-p16-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..76ed52fe5a57e509d04294164921760364e5b7cf --- /dev/null +++ b/tasks/agg-p16-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[30, 38, 51, 63, 63, 78]' > "$answer" diff --git a/tasks/agg-p16-n06-s03/task.toml b/tasks/agg-p16-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e2a102484c03aa05e7493ea4417e8952944c2bc1 --- /dev/null +++ b/tasks/agg-p16-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n06-s03/tests/expected.json b/tasks/agg-p16-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..97f29dfdb1c42f60a6b1d1cc6337bbae85778ae0 --- /dev/null +++ b/tasks/agg-p16-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[30, 38, 51, 63, 63, 78] diff --git a/tasks/agg-p16-n06-s03/tests/test.sh b/tasks/agg-p16-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n06-s04/instruction.md b/tasks/agg-p16-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0eb696327e075f8b7979003c950d443e8610306a --- /dev/null +++ b/tasks/agg-p16-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n06-s04/solution/solve.sh b/tasks/agg-p16-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..76ed52fe5a57e509d04294164921760364e5b7cf --- /dev/null +++ b/tasks/agg-p16-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[30, 38, 51, 63, 63, 78]' > "$answer" diff --git a/tasks/agg-p16-n06-s04/task.toml b/tasks/agg-p16-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2e273f95cec7143e90b5681ee5cbdb734f8820b5 --- /dev/null +++ b/tasks/agg-p16-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n06-s04/tests/expected.json b/tasks/agg-p16-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..97f29dfdb1c42f60a6b1d1cc6337bbae85778ae0 --- /dev/null +++ b/tasks/agg-p16-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[30, 38, 51, 63, 63, 78] diff --git a/tasks/agg-p16-n06-s04/tests/test.sh b/tasks/agg-p16-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n06-s05/instruction.md b/tasks/agg-p16-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f31755215085ecac3c28fde5f5e2ac8e24c067dd --- /dev/null +++ b/tasks/agg-p16-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n06-s05/solution/solve.sh b/tasks/agg-p16-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..76ed52fe5a57e509d04294164921760364e5b7cf --- /dev/null +++ b/tasks/agg-p16-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[30, 38, 51, 63, 63, 78]' > "$answer" diff --git a/tasks/agg-p16-n06-s05/task.toml b/tasks/agg-p16-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..823cf67844f4a0cb62f866fa06343595b0ca2556 --- /dev/null +++ b/tasks/agg-p16-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n06-s05/tests/expected.json b/tasks/agg-p16-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..97f29dfdb1c42f60a6b1d1cc6337bbae85778ae0 --- /dev/null +++ b/tasks/agg-p16-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[30, 38, 51, 63, 63, 78] diff --git a/tasks/agg-p16-n06-s05/tests/test.sh b/tasks/agg-p16-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n06-s06/instruction.md b/tasks/agg-p16-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..dcbded2dd49a98d0c30372568e3cdcae52a34893 --- /dev/null +++ b/tasks/agg-p16-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n06-s06/solution/solve.sh b/tasks/agg-p16-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..76ed52fe5a57e509d04294164921760364e5b7cf --- /dev/null +++ b/tasks/agg-p16-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[30, 38, 51, 63, 63, 78]' > "$answer" diff --git a/tasks/agg-p16-n06-s06/task.toml b/tasks/agg-p16-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4507ee3d2312fb4d039ecd597fb037a6eb5d77b2 --- /dev/null +++ b/tasks/agg-p16-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n06-s06/tests/expected.json b/tasks/agg-p16-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..97f29dfdb1c42f60a6b1d1cc6337bbae85778ae0 --- /dev/null +++ b/tasks/agg-p16-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[30, 38, 51, 63, 63, 78] diff --git a/tasks/agg-p16-n06-s06/tests/test.sh b/tasks/agg-p16-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n08-s01/instruction.md b/tasks/agg-p16-n08-s01/instruction.md index e21142b6e0df055b0e0bb6899f7eab5e6cc92fb4..afc952163a35fd3b6411c5d3e8199ea1d02f0544 100644 --- a/tasks/agg-p16-n08-s01/instruction.md +++ b/tasks/agg-p16-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n08-s01/tests/test.sh b/tasks/agg-p16-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n08-s01/tests/test.sh +++ b/tasks/agg-p16-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n08-s02/instruction.md b/tasks/agg-p16-n08-s02/instruction.md index 6770f155a73f8160420b131a19f4e1c1ecc0b159..a807811225f95af60844b17548c90165594e5e78 100644 --- a/tasks/agg-p16-n08-s02/instruction.md +++ b/tasks/agg-p16-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n08-s02/tests/test.sh b/tasks/agg-p16-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n08-s02/tests/test.sh +++ b/tasks/agg-p16-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n08-s03/instruction.md b/tasks/agg-p16-n08-s03/instruction.md index aad332f1fb6e8e8c81b09b86bbbdb88e339f2b43..484d040f8eb4d2ae4796aeef5cfb0918ac7f0782 100644 --- a/tasks/agg-p16-n08-s03/instruction.md +++ b/tasks/agg-p16-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n08-s03/tests/test.sh b/tasks/agg-p16-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n08-s03/tests/test.sh +++ b/tasks/agg-p16-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n08-s04/instruction.md b/tasks/agg-p16-n08-s04/instruction.md index 6770f155a73f8160420b131a19f4e1c1ecc0b159..a807811225f95af60844b17548c90165594e5e78 100644 --- a/tasks/agg-p16-n08-s04/instruction.md +++ b/tasks/agg-p16-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n08-s04/tests/test.sh b/tasks/agg-p16-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n08-s04/tests/test.sh +++ b/tasks/agg-p16-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n08-s05/instruction.md b/tasks/agg-p16-n08-s05/instruction.md index 820ba5235eb72205ef96f9b1bab51820f47403d9..e0abdd89b76cbe13833aaa27e72fee82f7079852 100644 --- a/tasks/agg-p16-n08-s05/instruction.md +++ b/tasks/agg-p16-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n08-s05/tests/test.sh b/tasks/agg-p16-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n08-s05/tests/test.sh +++ b/tasks/agg-p16-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n08-s06/instruction.md b/tasks/agg-p16-n08-s06/instruction.md index 0ee10142e61d08a5571772c533b83202fd01c84e..1d56cadf04393cae3e1d171ef0b958fbd4a2d7f4 100644 --- a/tasks/agg-p16-n08-s06/instruction.md +++ b/tasks/agg-p16-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n08-s06/tests/test.sh b/tasks/agg-p16-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n08-s06/tests/test.sh +++ b/tasks/agg-p16-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n08-s07/instruction.md b/tasks/agg-p16-n08-s07/instruction.md index e62126a64149a24e7278e73a216c4b232e5a78b2..b71e2424ef5ce0937a35b4ebd2df423d133331cc 100644 --- a/tasks/agg-p16-n08-s07/instruction.md +++ b/tasks/agg-p16-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n08-s07/tests/test.sh b/tasks/agg-p16-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n08-s07/tests/test.sh +++ b/tasks/agg-p16-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n08-s08/instruction.md b/tasks/agg-p16-n08-s08/instruction.md index 2af66d24dc696b132e6fd3eda0188f7a40c90b60..860958efbf695f34e33cd9d04c3d39b09cbfd196 100644 --- a/tasks/agg-p16-n08-s08/instruction.md +++ b/tasks/agg-p16-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n08-s08/tests/test.sh b/tasks/agg-p16-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n08-s08/tests/test.sh +++ b/tasks/agg-p16-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n12-s01/instruction.md b/tasks/agg-p16-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bb40c13254db093b772375b0bb70c64bc0b6f8b8 --- /dev/null +++ b/tasks/agg-p16-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n12-s01/solution/solve.sh b/tasks/agg-p16-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..705606030924061e1bf528cc3a471833e82254d1 --- /dev/null +++ b/tasks/agg-p16-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88]' > "$answer" diff --git a/tasks/agg-p16-n12-s01/task.toml b/tasks/agg-p16-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..869d91918b82c00fcdb3bb6268cce21c6c0d7e41 --- /dev/null +++ b/tasks/agg-p16-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n12-s01/tests/expected.json b/tasks/agg-p16-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..998acd2acf642b0d2ae8ea06d25b980b23371751 --- /dev/null +++ b/tasks/agg-p16-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88] diff --git a/tasks/agg-p16-n12-s01/tests/test.sh b/tasks/agg-p16-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n12-s02/instruction.md b/tasks/agg-p16-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7c90856f9c373634a273d06e4b993632457cf3cf --- /dev/null +++ b/tasks/agg-p16-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n12-s02/solution/solve.sh b/tasks/agg-p16-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..705606030924061e1bf528cc3a471833e82254d1 --- /dev/null +++ b/tasks/agg-p16-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88]' > "$answer" diff --git a/tasks/agg-p16-n12-s02/task.toml b/tasks/agg-p16-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0803377ca9afd81fd89a6386f7a710219fce0640 --- /dev/null +++ b/tasks/agg-p16-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n12-s02/tests/expected.json b/tasks/agg-p16-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..998acd2acf642b0d2ae8ea06d25b980b23371751 --- /dev/null +++ b/tasks/agg-p16-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88] diff --git a/tasks/agg-p16-n12-s02/tests/test.sh b/tasks/agg-p16-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n12-s03/instruction.md b/tasks/agg-p16-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1108fd5c3dfb974655fad089e4918849532b6756 --- /dev/null +++ b/tasks/agg-p16-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n12-s03/solution/solve.sh b/tasks/agg-p16-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..705606030924061e1bf528cc3a471833e82254d1 --- /dev/null +++ b/tasks/agg-p16-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88]' > "$answer" diff --git a/tasks/agg-p16-n12-s03/task.toml b/tasks/agg-p16-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..32b930492269011a23358e0b2a356b1c7fb1a802 --- /dev/null +++ b/tasks/agg-p16-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n12-s03/tests/expected.json b/tasks/agg-p16-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..998acd2acf642b0d2ae8ea06d25b980b23371751 --- /dev/null +++ b/tasks/agg-p16-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88] diff --git a/tasks/agg-p16-n12-s03/tests/test.sh b/tasks/agg-p16-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n12-s04/instruction.md b/tasks/agg-p16-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7c90856f9c373634a273d06e4b993632457cf3cf --- /dev/null +++ b/tasks/agg-p16-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n12-s04/solution/solve.sh b/tasks/agg-p16-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..705606030924061e1bf528cc3a471833e82254d1 --- /dev/null +++ b/tasks/agg-p16-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88]' > "$answer" diff --git a/tasks/agg-p16-n12-s04/task.toml b/tasks/agg-p16-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e7e019a03b70b421c8d33aef46ad8c7de8e7c149 --- /dev/null +++ b/tasks/agg-p16-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n12-s04/tests/expected.json b/tasks/agg-p16-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..998acd2acf642b0d2ae8ea06d25b980b23371751 --- /dev/null +++ b/tasks/agg-p16-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88] diff --git a/tasks/agg-p16-n12-s04/tests/test.sh b/tasks/agg-p16-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n12-s05/instruction.md b/tasks/agg-p16-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a6f6c527d4c1aacdad41d32eff67af8f36c275ba --- /dev/null +++ b/tasks/agg-p16-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n12-s05/solution/solve.sh b/tasks/agg-p16-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..705606030924061e1bf528cc3a471833e82254d1 --- /dev/null +++ b/tasks/agg-p16-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88]' > "$answer" diff --git a/tasks/agg-p16-n12-s05/task.toml b/tasks/agg-p16-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..11ad9930bfd839c78b7f6924eb7d2125765acc8c --- /dev/null +++ b/tasks/agg-p16-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n12-s05/tests/expected.json b/tasks/agg-p16-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..998acd2acf642b0d2ae8ea06d25b980b23371751 --- /dev/null +++ b/tasks/agg-p16-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88] diff --git a/tasks/agg-p16-n12-s05/tests/test.sh b/tasks/agg-p16-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n12-s06/instruction.md b/tasks/agg-p16-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..054dc42296a82036d581d99f90bd071c5bc61a63 --- /dev/null +++ b/tasks/agg-p16-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n12-s06/solution/solve.sh b/tasks/agg-p16-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..705606030924061e1bf528cc3a471833e82254d1 --- /dev/null +++ b/tasks/agg-p16-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88]' > "$answer" diff --git a/tasks/agg-p16-n12-s06/task.toml b/tasks/agg-p16-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b713d2b0cbf1d6e16f71f3710d981ff50999e5af --- /dev/null +++ b/tasks/agg-p16-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n12-s06/tests/expected.json b/tasks/agg-p16-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..998acd2acf642b0d2ae8ea06d25b980b23371751 --- /dev/null +++ b/tasks/agg-p16-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88] diff --git a/tasks/agg-p16-n12-s06/tests/test.sh b/tasks/agg-p16-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n12-s07/instruction.md b/tasks/agg-p16-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8b047c78be8ec74c45258c089b61fd8c92d01be1 --- /dev/null +++ b/tasks/agg-p16-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n12-s07/solution/solve.sh b/tasks/agg-p16-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..705606030924061e1bf528cc3a471833e82254d1 --- /dev/null +++ b/tasks/agg-p16-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88]' > "$answer" diff --git a/tasks/agg-p16-n12-s07/task.toml b/tasks/agg-p16-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5da38e8f996749cfe117674a45a1982f9a3e7248 --- /dev/null +++ b/tasks/agg-p16-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n12-s07/tests/expected.json b/tasks/agg-p16-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..998acd2acf642b0d2ae8ea06d25b980b23371751 --- /dev/null +++ b/tasks/agg-p16-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88] diff --git a/tasks/agg-p16-n12-s07/tests/test.sh b/tasks/agg-p16-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n12-s08/instruction.md b/tasks/agg-p16-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..83c5f678c22dac3906bb709f049b6407e3c59614 --- /dev/null +++ b/tasks/agg-p16-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n12-s08/solution/solve.sh b/tasks/agg-p16-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..705606030924061e1bf528cc3a471833e82254d1 --- /dev/null +++ b/tasks/agg-p16-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88]' > "$answer" diff --git a/tasks/agg-p16-n12-s08/task.toml b/tasks/agg-p16-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..650d85aa2097c2e6b969ba34eef6c231c3993d69 --- /dev/null +++ b/tasks/agg-p16-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n12-s08/tests/expected.json b/tasks/agg-p16-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..998acd2acf642b0d2ae8ea06d25b980b23371751 --- /dev/null +++ b/tasks/agg-p16-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88] diff --git a/tasks/agg-p16-n12-s08/tests/test.sh b/tasks/agg-p16-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n12-s09/instruction.md b/tasks/agg-p16-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..afc44302e5446bbcbad60907a837f2fdde13fc15 --- /dev/null +++ b/tasks/agg-p16-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n12-s09/solution/solve.sh b/tasks/agg-p16-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..705606030924061e1bf528cc3a471833e82254d1 --- /dev/null +++ b/tasks/agg-p16-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88]' > "$answer" diff --git a/tasks/agg-p16-n12-s09/task.toml b/tasks/agg-p16-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..87413eadc1aeeb342bfd49f44d01b47a1d0f78dc --- /dev/null +++ b/tasks/agg-p16-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n12-s09/tests/expected.json b/tasks/agg-p16-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..998acd2acf642b0d2ae8ea06d25b980b23371751 --- /dev/null +++ b/tasks/agg-p16-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88] diff --git a/tasks/agg-p16-n12-s09/tests/test.sh b/tasks/agg-p16-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n12-s10/instruction.md b/tasks/agg-p16-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bc6ecc07cf5acdcd085bd56b2102f26cc68f534e --- /dev/null +++ b/tasks/agg-p16-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n12-s10/solution/solve.sh b/tasks/agg-p16-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..705606030924061e1bf528cc3a471833e82254d1 --- /dev/null +++ b/tasks/agg-p16-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88]' > "$answer" diff --git a/tasks/agg-p16-n12-s10/task.toml b/tasks/agg-p16-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7b2c83b131126b9aca128b93bb060cb9b2c27b80 --- /dev/null +++ b/tasks/agg-p16-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n12-s10/tests/expected.json b/tasks/agg-p16-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..998acd2acf642b0d2ae8ea06d25b980b23371751 --- /dev/null +++ b/tasks/agg-p16-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88] diff --git a/tasks/agg-p16-n12-s10/tests/test.sh b/tasks/agg-p16-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n12-s11/instruction.md b/tasks/agg-p16-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ca689d19db465172c22b2b5dc9acaa4689858529 --- /dev/null +++ b/tasks/agg-p16-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n12-s11/solution/solve.sh b/tasks/agg-p16-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..705606030924061e1bf528cc3a471833e82254d1 --- /dev/null +++ b/tasks/agg-p16-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88]' > "$answer" diff --git a/tasks/agg-p16-n12-s11/task.toml b/tasks/agg-p16-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5bd4c10be8d2f7faa1a343418f35f3fe0efe2f65 --- /dev/null +++ b/tasks/agg-p16-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n12-s11/tests/expected.json b/tasks/agg-p16-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..998acd2acf642b0d2ae8ea06d25b980b23371751 --- /dev/null +++ b/tasks/agg-p16-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88] diff --git a/tasks/agg-p16-n12-s11/tests/test.sh b/tasks/agg-p16-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n12-s12/instruction.md b/tasks/agg-p16-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fecaa35f4770297f29a146761d64774bbee9ff8f --- /dev/null +++ b/tasks/agg-p16-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ten. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n12-s12/solution/solve.sh b/tasks/agg-p16-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..705606030924061e1bf528cc3a471833e82254d1 --- /dev/null +++ b/tasks/agg-p16-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88]' > "$answer" diff --git a/tasks/agg-p16-n12-s12/task.toml b/tasks/agg-p16-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..749ad13a09f0a4a6f0593b864ab1afbf2e2c5c17 --- /dev/null +++ b/tasks/agg-p16-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p16-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 16 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p16-n12-s12/tests/expected.json b/tasks/agg-p16-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..998acd2acf642b0d2ae8ea06d25b980b23371751 --- /dev/null +++ b/tasks/agg-p16-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 18, 30, 38, 51, 58, 63, 63, 78, 81, 88] diff --git a/tasks/agg-p16-n12-s12/tests/test.sh b/tasks/agg-p16-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p16-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p16-n16-s01/instruction.md b/tasks/agg-p16-n16-s01/instruction.md index d398ea97722601a49a457530f502678c0a1433cf..e1c1f7d3b01724d8dea774465c5f5d8397b1d161 100644 --- a/tasks/agg-p16-n16-s01/instruction.md +++ b/tasks/agg-p16-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s01/tests/test.sh b/tasks/agg-p16-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s01/tests/test.sh +++ b/tasks/agg-p16-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s02/instruction.md b/tasks/agg-p16-n16-s02/instruction.md index eec0889f35f181e3d5ee370338313f8afc894fe8..741d5c897d7dc6413c1bb96a8b00478c60c908ba 100644 --- a/tasks/agg-p16-n16-s02/instruction.md +++ b/tasks/agg-p16-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s02/tests/test.sh b/tasks/agg-p16-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s02/tests/test.sh +++ b/tasks/agg-p16-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s03/instruction.md b/tasks/agg-p16-n16-s03/instruction.md index 6b3716855407e49bd1a2d27bc51b41f58fa7bb68..25ebaaacc5fd550a5645a5bd0d6a6adf1dfebf49 100644 --- a/tasks/agg-p16-n16-s03/instruction.md +++ b/tasks/agg-p16-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s03/tests/test.sh b/tasks/agg-p16-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s03/tests/test.sh +++ b/tasks/agg-p16-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s04/instruction.md b/tasks/agg-p16-n16-s04/instruction.md index eec0889f35f181e3d5ee370338313f8afc894fe8..741d5c897d7dc6413c1bb96a8b00478c60c908ba 100644 --- a/tasks/agg-p16-n16-s04/instruction.md +++ b/tasks/agg-p16-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s04/tests/test.sh b/tasks/agg-p16-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s04/tests/test.sh +++ b/tasks/agg-p16-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s05/instruction.md b/tasks/agg-p16-n16-s05/instruction.md index fb03ade0279ecf776a2ba0e785bd133ee36ecac6..3a629248b9ad5c45b818dd2ecd91107928508549 100644 --- a/tasks/agg-p16-n16-s05/instruction.md +++ b/tasks/agg-p16-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s05/tests/test.sh b/tasks/agg-p16-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s05/tests/test.sh +++ b/tasks/agg-p16-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s06/instruction.md b/tasks/agg-p16-n16-s06/instruction.md index bd54876511397bdb80a3c3299556503e1fd15da5..ffc3934425adafa34ada41ff5621db5d0f97a3bb 100644 --- a/tasks/agg-p16-n16-s06/instruction.md +++ b/tasks/agg-p16-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s06/tests/test.sh b/tasks/agg-p16-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s06/tests/test.sh +++ b/tasks/agg-p16-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s07/instruction.md b/tasks/agg-p16-n16-s07/instruction.md index e5c784e3be1e3c1c8c8931ac55ae2345c1d7e341..0132dbcb468155a843c8c2b7a4a9e6ca2be0c499 100644 --- a/tasks/agg-p16-n16-s07/instruction.md +++ b/tasks/agg-p16-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s07/tests/test.sh b/tasks/agg-p16-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s07/tests/test.sh +++ b/tasks/agg-p16-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s08/instruction.md b/tasks/agg-p16-n16-s08/instruction.md index be22dd060dc917313859b782fc59371588c6eefe..1ae1c83f6310b28c94d56fb3f9788827f371c4c2 100644 --- a/tasks/agg-p16-n16-s08/instruction.md +++ b/tasks/agg-p16-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s08/tests/test.sh b/tasks/agg-p16-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s08/tests/test.sh +++ b/tasks/agg-p16-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s09/instruction.md b/tasks/agg-p16-n16-s09/instruction.md index ebbf18dd1885eca56e4b99d9ba0f301603987c59..967cbe42235491e28138a2858f78709704a1bd82 100644 --- a/tasks/agg-p16-n16-s09/instruction.md +++ b/tasks/agg-p16-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s09/tests/test.sh b/tasks/agg-p16-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s09/tests/test.sh +++ b/tasks/agg-p16-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s10/instruction.md b/tasks/agg-p16-n16-s10/instruction.md index 57c62f85ec1ef4f9ca9aa899d016621c4b04432a..e1bd267ed9ac9c4fbf94870756f771be1265779a 100644 --- a/tasks/agg-p16-n16-s10/instruction.md +++ b/tasks/agg-p16-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s10/tests/test.sh b/tasks/agg-p16-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s10/tests/test.sh +++ b/tasks/agg-p16-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s11/instruction.md b/tasks/agg-p16-n16-s11/instruction.md index f197f79da6e4638891b46f2053909c167ec13c32..856f7627093ea9ba708f7c4461f757925253fef9 100644 --- a/tasks/agg-p16-n16-s11/instruction.md +++ b/tasks/agg-p16-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s11/tests/test.sh b/tasks/agg-p16-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s11/tests/test.sh +++ b/tasks/agg-p16-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s12/instruction.md b/tasks/agg-p16-n16-s12/instruction.md index 15dcbc6a01201bc29446da73c6532fccce6c79d2..ed78cbe54ff7c90674c657e53e6c6135b38c5fb4 100644 --- a/tasks/agg-p16-n16-s12/instruction.md +++ b/tasks/agg-p16-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s12/tests/test.sh b/tasks/agg-p16-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s12/tests/test.sh +++ b/tasks/agg-p16-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s13/instruction.md b/tasks/agg-p16-n16-s13/instruction.md index e5c784e3be1e3c1c8c8931ac55ae2345c1d7e341..0132dbcb468155a843c8c2b7a4a9e6ca2be0c499 100644 --- a/tasks/agg-p16-n16-s13/instruction.md +++ b/tasks/agg-p16-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s13/tests/test.sh b/tasks/agg-p16-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s13/tests/test.sh +++ b/tasks/agg-p16-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s14/instruction.md b/tasks/agg-p16-n16-s14/instruction.md index 1fe2576f1a20a278b177c066abc20e44af6a4729..5a9e9eac10d0ea0b9cedb5eefc9f2ace5395d6a9 100644 --- a/tasks/agg-p16-n16-s14/instruction.md +++ b/tasks/agg-p16-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s14/tests/test.sh b/tasks/agg-p16-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s14/tests/test.sh +++ b/tasks/agg-p16-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s15/instruction.md b/tasks/agg-p16-n16-s15/instruction.md index ff35f53eda015951f8078ff0751a783f65818958..e3de5217dbfb10d0002092b53e5f480dfe257ac6 100644 --- a/tasks/agg-p16-n16-s15/instruction.md +++ b/tasks/agg-p16-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s15/tests/test.sh b/tasks/agg-p16-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s15/tests/test.sh +++ b/tasks/agg-p16-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p16-n16-s16/instruction.md b/tasks/agg-p16-n16-s16/instruction.md index 8e668cd99b85cf802939dffe8e766b769fcc702e..87e4a5f52a7382cfe533f0cb59ccf7425210c8fe 100644 --- a/tasks/agg-p16-n16-s16/instruction.md +++ b/tasks/agg-p16-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p16-n16-s16/tests/test.sh b/tasks/agg-p16-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p16-n16-s16/tests/test.sh +++ b/tasks/agg-p16-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n01-s01/instruction.md b/tasks/agg-p17-n01-s01/instruction.md index d0eb215fbe88c75282dd93b86f1247f5258aeca5..8c96828a8007e87f9f27a9b660371c74fb62feb6 100644 --- a/tasks/agg-p17-n01-s01/instruction.md +++ b/tasks/agg-p17-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is forty. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p17-n01-s01/tests/test.sh b/tasks/agg-p17-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n01-s01/tests/test.sh +++ b/tasks/agg-p17-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n02-s01/instruction.md b/tasks/agg-p17-n02-s01/instruction.md index 393e555ec1d2b25cc4eef73d76af3df0ebc9f6ce..bd4b65325dd032135e1b13aa4a351d44469aeb29 100644 --- a/tasks/agg-p17-n02-s01/instruction.md +++ b/tasks/agg-p17-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n02-s01/tests/test.sh b/tasks/agg-p17-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n02-s01/tests/test.sh +++ b/tasks/agg-p17-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n02-s02/instruction.md b/tasks/agg-p17-n02-s02/instruction.md index e15064d1626e4f2b5416e402f5acfe32d261a660..672d6224b2bb751f322280cd07e9e1b19a3030a2 100644 --- a/tasks/agg-p17-n02-s02/instruction.md +++ b/tasks/agg-p17-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n02-s02/tests/test.sh b/tasks/agg-p17-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n02-s02/tests/test.sh +++ b/tasks/agg-p17-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n04-s01/instruction.md b/tasks/agg-p17-n04-s01/instruction.md index 525b5a36580eb1d89ffda210a1193456cab19921..cb3a599841979a590b9dc6c125d562ddc1e49fab 100644 --- a/tasks/agg-p17-n04-s01/instruction.md +++ b/tasks/agg-p17-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n04-s01/tests/test.sh b/tasks/agg-p17-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n04-s01/tests/test.sh +++ b/tasks/agg-p17-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n04-s02/instruction.md b/tasks/agg-p17-n04-s02/instruction.md index a61c4a37b633040de8487771096616ccddc11b1f..07efab793aa41bde1b726b6873c885bd11ad16e1 100644 --- a/tasks/agg-p17-n04-s02/instruction.md +++ b/tasks/agg-p17-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n04-s02/tests/test.sh b/tasks/agg-p17-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n04-s02/tests/test.sh +++ b/tasks/agg-p17-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n04-s03/instruction.md b/tasks/agg-p17-n04-s03/instruction.md index a0bd19ac3b592052aada59c15e572699cc95d555..9f271e6e5bd2b76802e443ccc54abcbd82366944 100644 --- a/tasks/agg-p17-n04-s03/instruction.md +++ b/tasks/agg-p17-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n04-s03/tests/test.sh b/tasks/agg-p17-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n04-s03/tests/test.sh +++ b/tasks/agg-p17-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n04-s04/instruction.md b/tasks/agg-p17-n04-s04/instruction.md index 97ac9ac146de9f03c6e5d578343f2006a77a9d07..f6a86e8c8fb48e54730ce4049da5da9b2528701d 100644 --- a/tasks/agg-p17-n04-s04/instruction.md +++ b/tasks/agg-p17-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n04-s04/tests/test.sh b/tasks/agg-p17-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n04-s04/tests/test.sh +++ b/tasks/agg-p17-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n06-s01/instruction.md b/tasks/agg-p17-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a85f12b18f520ed02306f7601d3daf87529d5788 --- /dev/null +++ b/tasks/agg-p17-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n06-s01/solution/solve.sh b/tasks/agg-p17-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f1b89ad84f9ad5c6e211df5f6cab841c3bd202ea --- /dev/null +++ b/tasks/agg-p17-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 31, 40, 77, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n06-s01/task.toml b/tasks/agg-p17-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f6415cd6159320c8b1c1e77a420a17b1d7e46fe7 --- /dev/null +++ b/tasks/agg-p17-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n06-s01/tests/expected.json b/tasks/agg-p17-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..337c742e1e3378f46802f746fdb13a0df81c967a --- /dev/null +++ b/tasks/agg-p17-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[10, 31, 40, 77, 95, 99] diff --git a/tasks/agg-p17-n06-s01/tests/test.sh b/tasks/agg-p17-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n06-s02/instruction.md b/tasks/agg-p17-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..256d7bc176acffa7ed5394bf8edd738765e0d8b5 --- /dev/null +++ b/tasks/agg-p17-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ten. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n06-s02/solution/solve.sh b/tasks/agg-p17-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f1b89ad84f9ad5c6e211df5f6cab841c3bd202ea --- /dev/null +++ b/tasks/agg-p17-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 31, 40, 77, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n06-s02/task.toml b/tasks/agg-p17-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..97000e76311671896aa97b6ecc091557c24bc10d --- /dev/null +++ b/tasks/agg-p17-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n06-s02/tests/expected.json b/tasks/agg-p17-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..337c742e1e3378f46802f746fdb13a0df81c967a --- /dev/null +++ b/tasks/agg-p17-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[10, 31, 40, 77, 95, 99] diff --git a/tasks/agg-p17-n06-s02/tests/test.sh b/tasks/agg-p17-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n06-s03/instruction.md b/tasks/agg-p17-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6edae5a0cf2c4c0ea01e4142c514ceefe0b054da --- /dev/null +++ b/tasks/agg-p17-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n06-s03/solution/solve.sh b/tasks/agg-p17-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f1b89ad84f9ad5c6e211df5f6cab841c3bd202ea --- /dev/null +++ b/tasks/agg-p17-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 31, 40, 77, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n06-s03/task.toml b/tasks/agg-p17-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b18ccc9f7953d4848e1acf71d1a9ea68baeae4cb --- /dev/null +++ b/tasks/agg-p17-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n06-s03/tests/expected.json b/tasks/agg-p17-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..337c742e1e3378f46802f746fdb13a0df81c967a --- /dev/null +++ b/tasks/agg-p17-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[10, 31, 40, 77, 95, 99] diff --git a/tasks/agg-p17-n06-s03/tests/test.sh b/tasks/agg-p17-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n06-s04/instruction.md b/tasks/agg-p17-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..198030c37a935e446e33c98a47dbfa5b7b79cc4d --- /dev/null +++ b/tasks/agg-p17-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n06-s04/solution/solve.sh b/tasks/agg-p17-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f1b89ad84f9ad5c6e211df5f6cab841c3bd202ea --- /dev/null +++ b/tasks/agg-p17-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 31, 40, 77, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n06-s04/task.toml b/tasks/agg-p17-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4d77cc3180abfa09e5424434f13a89e348cf8c1c --- /dev/null +++ b/tasks/agg-p17-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n06-s04/tests/expected.json b/tasks/agg-p17-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..337c742e1e3378f46802f746fdb13a0df81c967a --- /dev/null +++ b/tasks/agg-p17-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[10, 31, 40, 77, 95, 99] diff --git a/tasks/agg-p17-n06-s04/tests/test.sh b/tasks/agg-p17-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n06-s05/instruction.md b/tasks/agg-p17-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2da0c8e2076394d2c2f2270ad3b964940d1e2f12 --- /dev/null +++ b/tasks/agg-p17-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n06-s05/solution/solve.sh b/tasks/agg-p17-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f1b89ad84f9ad5c6e211df5f6cab841c3bd202ea --- /dev/null +++ b/tasks/agg-p17-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 31, 40, 77, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n06-s05/task.toml b/tasks/agg-p17-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..be8eb7f0dcb02706c8c81a989d811db8af9dc500 --- /dev/null +++ b/tasks/agg-p17-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n06-s05/tests/expected.json b/tasks/agg-p17-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..337c742e1e3378f46802f746fdb13a0df81c967a --- /dev/null +++ b/tasks/agg-p17-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[10, 31, 40, 77, 95, 99] diff --git a/tasks/agg-p17-n06-s05/tests/test.sh b/tasks/agg-p17-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n06-s06/instruction.md b/tasks/agg-p17-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..13f406ae289f8384485c9a9245cb8587110394d5 --- /dev/null +++ b/tasks/agg-p17-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n06-s06/solution/solve.sh b/tasks/agg-p17-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..f1b89ad84f9ad5c6e211df5f6cab841c3bd202ea --- /dev/null +++ b/tasks/agg-p17-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 31, 40, 77, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n06-s06/task.toml b/tasks/agg-p17-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b53ff97b65412148021f29f064eda0c861e79a52 --- /dev/null +++ b/tasks/agg-p17-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n06-s06/tests/expected.json b/tasks/agg-p17-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..337c742e1e3378f46802f746fdb13a0df81c967a --- /dev/null +++ b/tasks/agg-p17-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[10, 31, 40, 77, 95, 99] diff --git a/tasks/agg-p17-n06-s06/tests/test.sh b/tasks/agg-p17-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n08-s01/instruction.md b/tasks/agg-p17-n08-s01/instruction.md index d7293023b756e96b4a6f07b0a65c2cc3406ac4be..bdf5bdd40bc567aa9d5da83763d074be44e853b3 100644 --- a/tasks/agg-p17-n08-s01/instruction.md +++ b/tasks/agg-p17-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n08-s01/tests/test.sh b/tasks/agg-p17-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n08-s01/tests/test.sh +++ b/tasks/agg-p17-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n08-s02/instruction.md b/tasks/agg-p17-n08-s02/instruction.md index 51e8ab49392a4426a4d85f07881697d0fa17cfef..45a820a9f48be217b1d66384ffde4a92bc7e239f 100644 --- a/tasks/agg-p17-n08-s02/instruction.md +++ b/tasks/agg-p17-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n08-s02/tests/test.sh b/tasks/agg-p17-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n08-s02/tests/test.sh +++ b/tasks/agg-p17-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n08-s03/instruction.md b/tasks/agg-p17-n08-s03/instruction.md index a042cb763ccdabe4fefaa1c5911478c0a369e6d0..404dd56dd7f109b5fe4e8b8fdcf1e15a36a23e04 100644 --- a/tasks/agg-p17-n08-s03/instruction.md +++ b/tasks/agg-p17-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n08-s03/tests/test.sh b/tasks/agg-p17-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n08-s03/tests/test.sh +++ b/tasks/agg-p17-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n08-s04/instruction.md b/tasks/agg-p17-n08-s04/instruction.md index 1069c5f3cbcf0e06c5b92f0ca4c7a088d295f7f6..e106315c611ef4700a50c108ef96a7b8f7be3406 100644 --- a/tasks/agg-p17-n08-s04/instruction.md +++ b/tasks/agg-p17-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n08-s04/tests/test.sh b/tasks/agg-p17-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n08-s04/tests/test.sh +++ b/tasks/agg-p17-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n08-s05/instruction.md b/tasks/agg-p17-n08-s05/instruction.md index 20c75cc16db467c29e541a706205beed9fbbe75d..fa30070f61094288c088b08bfc8b901d9e75a2c6 100644 --- a/tasks/agg-p17-n08-s05/instruction.md +++ b/tasks/agg-p17-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n08-s05/tests/test.sh b/tasks/agg-p17-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n08-s05/tests/test.sh +++ b/tasks/agg-p17-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n08-s06/instruction.md b/tasks/agg-p17-n08-s06/instruction.md index fcb1550a490d72b760744b8ed931194f57a75250..c13b7d01671e36bec9b4b71fd7c0dc1d979486ec 100644 --- a/tasks/agg-p17-n08-s06/instruction.md +++ b/tasks/agg-p17-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n08-s06/tests/test.sh b/tasks/agg-p17-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n08-s06/tests/test.sh +++ b/tasks/agg-p17-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n08-s07/instruction.md b/tasks/agg-p17-n08-s07/instruction.md index 3d680c6e106b56337740b69832fd529620869a7a..a26b636fa2fb13a4ac045458776319e1348e3b1a 100644 --- a/tasks/agg-p17-n08-s07/instruction.md +++ b/tasks/agg-p17-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n08-s07/tests/test.sh b/tasks/agg-p17-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n08-s07/tests/test.sh +++ b/tasks/agg-p17-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n08-s08/instruction.md b/tasks/agg-p17-n08-s08/instruction.md index 0b145aa6f7984df45e66ec21f6a52c77dba2a1a6..ac14e6f763f8a61d767f33044d08ee95695fffcb 100644 --- a/tasks/agg-p17-n08-s08/instruction.md +++ b/tasks/agg-p17-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n08-s08/tests/test.sh b/tasks/agg-p17-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n08-s08/tests/test.sh +++ b/tasks/agg-p17-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n12-s01/instruction.md b/tasks/agg-p17-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..38af6f0bdb6b176fabb077ede4dd67eef822da02 --- /dev/null +++ b/tasks/agg-p17-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n12-s01/solution/solve.sh b/tasks/agg-p17-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e85aa877e3fe3323bb5ba3c8921846324a4299b4 --- /dev/null +++ b/tasks/agg-p17-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n12-s01/task.toml b/tasks/agg-p17-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b2a1a0f299841b69a27db974358e27d215a4003d --- /dev/null +++ b/tasks/agg-p17-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n12-s01/tests/expected.json b/tasks/agg-p17-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..79324dfc212609965af1316435e7be500fb3cbdd --- /dev/null +++ b/tasks/agg-p17-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99] diff --git a/tasks/agg-p17-n12-s01/tests/test.sh b/tasks/agg-p17-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n12-s02/instruction.md b/tasks/agg-p17-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fecaa35f4770297f29a146761d64774bbee9ff8f --- /dev/null +++ b/tasks/agg-p17-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ten. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n12-s02/solution/solve.sh b/tasks/agg-p17-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e85aa877e3fe3323bb5ba3c8921846324a4299b4 --- /dev/null +++ b/tasks/agg-p17-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n12-s02/task.toml b/tasks/agg-p17-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8e507860062820c9c97a14bd06fbff7af8f80642 --- /dev/null +++ b/tasks/agg-p17-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n12-s02/tests/expected.json b/tasks/agg-p17-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..79324dfc212609965af1316435e7be500fb3cbdd --- /dev/null +++ b/tasks/agg-p17-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99] diff --git a/tasks/agg-p17-n12-s02/tests/test.sh b/tasks/agg-p17-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n12-s03/instruction.md b/tasks/agg-p17-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f5aa8b70f2f447fb84dd6b26d80c8d7537bebefb --- /dev/null +++ b/tasks/agg-p17-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n12-s03/solution/solve.sh b/tasks/agg-p17-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e85aa877e3fe3323bb5ba3c8921846324a4299b4 --- /dev/null +++ b/tasks/agg-p17-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n12-s03/task.toml b/tasks/agg-p17-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8cccdc4b4bae1e3bb9eeb84e825652e5fb0e0610 --- /dev/null +++ b/tasks/agg-p17-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n12-s03/tests/expected.json b/tasks/agg-p17-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..79324dfc212609965af1316435e7be500fb3cbdd --- /dev/null +++ b/tasks/agg-p17-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99] diff --git a/tasks/agg-p17-n12-s03/tests/test.sh b/tasks/agg-p17-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n12-s04/instruction.md b/tasks/agg-p17-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5435b7812ef266a4e2ec6b0a93d3c306439294ba --- /dev/null +++ b/tasks/agg-p17-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n12-s04/solution/solve.sh b/tasks/agg-p17-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e85aa877e3fe3323bb5ba3c8921846324a4299b4 --- /dev/null +++ b/tasks/agg-p17-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n12-s04/task.toml b/tasks/agg-p17-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9220f835aced1305cc26398b530ce0b20de1f6ce --- /dev/null +++ b/tasks/agg-p17-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n12-s04/tests/expected.json b/tasks/agg-p17-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..79324dfc212609965af1316435e7be500fb3cbdd --- /dev/null +++ b/tasks/agg-p17-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99] diff --git a/tasks/agg-p17-n12-s04/tests/test.sh b/tasks/agg-p17-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n12-s05/instruction.md b/tasks/agg-p17-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..40f3f7e13cfd3a8040e44274dd1b8429c6804923 --- /dev/null +++ b/tasks/agg-p17-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n12-s05/solution/solve.sh b/tasks/agg-p17-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e85aa877e3fe3323bb5ba3c8921846324a4299b4 --- /dev/null +++ b/tasks/agg-p17-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n12-s05/task.toml b/tasks/agg-p17-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bea5666f9f46f48fe3a8239fb626947e8279cfa5 --- /dev/null +++ b/tasks/agg-p17-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n12-s05/tests/expected.json b/tasks/agg-p17-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..79324dfc212609965af1316435e7be500fb3cbdd --- /dev/null +++ b/tasks/agg-p17-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99] diff --git a/tasks/agg-p17-n12-s05/tests/test.sh b/tasks/agg-p17-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n12-s06/instruction.md b/tasks/agg-p17-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f4b49efc3c821e0d716e0443cac99bdb036d4e81 --- /dev/null +++ b/tasks/agg-p17-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n12-s06/solution/solve.sh b/tasks/agg-p17-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e85aa877e3fe3323bb5ba3c8921846324a4299b4 --- /dev/null +++ b/tasks/agg-p17-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n12-s06/task.toml b/tasks/agg-p17-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a50f887c43524751c73feabde043a192ac4cfe25 --- /dev/null +++ b/tasks/agg-p17-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n12-s06/tests/expected.json b/tasks/agg-p17-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..79324dfc212609965af1316435e7be500fb3cbdd --- /dev/null +++ b/tasks/agg-p17-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99] diff --git a/tasks/agg-p17-n12-s06/tests/test.sh b/tasks/agg-p17-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n12-s07/instruction.md b/tasks/agg-p17-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..af43acb9caba28ebabccb04957da32e506624fbb --- /dev/null +++ b/tasks/agg-p17-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n12-s07/solution/solve.sh b/tasks/agg-p17-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e85aa877e3fe3323bb5ba3c8921846324a4299b4 --- /dev/null +++ b/tasks/agg-p17-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n12-s07/task.toml b/tasks/agg-p17-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..20c3332d99e2e502372973d0f1101be6091ddf43 --- /dev/null +++ b/tasks/agg-p17-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n12-s07/tests/expected.json b/tasks/agg-p17-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..79324dfc212609965af1316435e7be500fb3cbdd --- /dev/null +++ b/tasks/agg-p17-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99] diff --git a/tasks/agg-p17-n12-s07/tests/test.sh b/tasks/agg-p17-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n12-s08/instruction.md b/tasks/agg-p17-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..addd22697de677a2c2079817ecf992d0d4b0b0ff --- /dev/null +++ b/tasks/agg-p17-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n12-s08/solution/solve.sh b/tasks/agg-p17-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e85aa877e3fe3323bb5ba3c8921846324a4299b4 --- /dev/null +++ b/tasks/agg-p17-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n12-s08/task.toml b/tasks/agg-p17-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3b6d57b2fce29f97717c5bf08abcf505ea52a056 --- /dev/null +++ b/tasks/agg-p17-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n12-s08/tests/expected.json b/tasks/agg-p17-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..79324dfc212609965af1316435e7be500fb3cbdd --- /dev/null +++ b/tasks/agg-p17-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99] diff --git a/tasks/agg-p17-n12-s08/tests/test.sh b/tasks/agg-p17-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n12-s09/instruction.md b/tasks/agg-p17-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..894c08d452dd150a471307a3b982c78b62f7152f --- /dev/null +++ b/tasks/agg-p17-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n12-s09/solution/solve.sh b/tasks/agg-p17-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e85aa877e3fe3323bb5ba3c8921846324a4299b4 --- /dev/null +++ b/tasks/agg-p17-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n12-s09/task.toml b/tasks/agg-p17-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a1e2128fcb417f0f221509a80254c430d7ead802 --- /dev/null +++ b/tasks/agg-p17-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n12-s09/tests/expected.json b/tasks/agg-p17-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..79324dfc212609965af1316435e7be500fb3cbdd --- /dev/null +++ b/tasks/agg-p17-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99] diff --git a/tasks/agg-p17-n12-s09/tests/test.sh b/tasks/agg-p17-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n12-s10/instruction.md b/tasks/agg-p17-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..afc44302e5446bbcbad60907a837f2fdde13fc15 --- /dev/null +++ b/tasks/agg-p17-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n12-s10/solution/solve.sh b/tasks/agg-p17-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e85aa877e3fe3323bb5ba3c8921846324a4299b4 --- /dev/null +++ b/tasks/agg-p17-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n12-s10/task.toml b/tasks/agg-p17-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7481f9cabe016903948f69cc22e820b6c0133214 --- /dev/null +++ b/tasks/agg-p17-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n12-s10/tests/expected.json b/tasks/agg-p17-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..79324dfc212609965af1316435e7be500fb3cbdd --- /dev/null +++ b/tasks/agg-p17-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99] diff --git a/tasks/agg-p17-n12-s10/tests/test.sh b/tasks/agg-p17-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n12-s11/instruction.md b/tasks/agg-p17-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..054dc42296a82036d581d99f90bd071c5bc61a63 --- /dev/null +++ b/tasks/agg-p17-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n12-s11/solution/solve.sh b/tasks/agg-p17-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e85aa877e3fe3323bb5ba3c8921846324a4299b4 --- /dev/null +++ b/tasks/agg-p17-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n12-s11/task.toml b/tasks/agg-p17-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7aa03167b4f039947e859d8dd824373aff88159d --- /dev/null +++ b/tasks/agg-p17-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n12-s11/tests/expected.json b/tasks/agg-p17-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..79324dfc212609965af1316435e7be500fb3cbdd --- /dev/null +++ b/tasks/agg-p17-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99] diff --git a/tasks/agg-p17-n12-s11/tests/test.sh b/tasks/agg-p17-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n12-s12/instruction.md b/tasks/agg-p17-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f216e45e1729bdead394f5240fbbd01f063ca35a --- /dev/null +++ b/tasks/agg-p17-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n12-s12/solution/solve.sh b/tasks/agg-p17-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e85aa877e3fe3323bb5ba3c8921846324a4299b4 --- /dev/null +++ b/tasks/agg-p17-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99]' > "$answer" diff --git a/tasks/agg-p17-n12-s12/task.toml b/tasks/agg-p17-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3e5460250e675438508f00a66532a8505a8378bb --- /dev/null +++ b/tasks/agg-p17-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p17-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 17 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p17-n12-s12/tests/expected.json b/tasks/agg-p17-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..79324dfc212609965af1316435e7be500fb3cbdd --- /dev/null +++ b/tasks/agg-p17-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[2, 10, 31, 34, 40, 43, 70, 77, 78, 90, 95, 99] diff --git a/tasks/agg-p17-n12-s12/tests/test.sh b/tasks/agg-p17-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p17-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p17-n16-s01/instruction.md b/tasks/agg-p17-n16-s01/instruction.md index ebe30196b058cfe81ab8a53dd5461649bcf91202..7078e28d54452ae1cab8849d4648225bf8c92be9 100644 --- a/tasks/agg-p17-n16-s01/instruction.md +++ b/tasks/agg-p17-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s01/tests/test.sh b/tasks/agg-p17-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s01/tests/test.sh +++ b/tasks/agg-p17-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s02/instruction.md b/tasks/agg-p17-n16-s02/instruction.md index 15dcbc6a01201bc29446da73c6532fccce6c79d2..ed78cbe54ff7c90674c657e53e6c6135b38c5fb4 100644 --- a/tasks/agg-p17-n16-s02/instruction.md +++ b/tasks/agg-p17-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s02/tests/test.sh b/tasks/agg-p17-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s02/tests/test.sh +++ b/tasks/agg-p17-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s03/instruction.md b/tasks/agg-p17-n16-s03/instruction.md index 961985392d4b99bbc35d52871fb6450061a34bb5..c98bd62598f64ffcd1b51c3b31ced8e3cda7460c 100644 --- a/tasks/agg-p17-n16-s03/instruction.md +++ b/tasks/agg-p17-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s03/tests/test.sh b/tasks/agg-p17-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s03/tests/test.sh +++ b/tasks/agg-p17-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s04/instruction.md b/tasks/agg-p17-n16-s04/instruction.md index 1245386f0aba38aec1627364e9a0bdce0b3a3214..7a6abd7e671d0d5e514cf3a081a12822f3e1fa80 100644 --- a/tasks/agg-p17-n16-s04/instruction.md +++ b/tasks/agg-p17-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s04/tests/test.sh b/tasks/agg-p17-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s04/tests/test.sh +++ b/tasks/agg-p17-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s05/instruction.md b/tasks/agg-p17-n16-s05/instruction.md index e5e3f1447d4ff13fe5188dafc1b5104a3c8f0e59..f9fc0a05d4cbd2084dc7f80c349485aae4d72692 100644 --- a/tasks/agg-p17-n16-s05/instruction.md +++ b/tasks/agg-p17-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s05/tests/test.sh b/tasks/agg-p17-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s05/tests/test.sh +++ b/tasks/agg-p17-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s06/instruction.md b/tasks/agg-p17-n16-s06/instruction.md index 3a10e21a080f18532e8e18935bc65496e13588a2..3b81386b59fb88e5b2c11fc6768f76e2b16d0fe9 100644 --- a/tasks/agg-p17-n16-s06/instruction.md +++ b/tasks/agg-p17-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s06/tests/test.sh b/tasks/agg-p17-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s06/tests/test.sh +++ b/tasks/agg-p17-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s07/instruction.md b/tasks/agg-p17-n16-s07/instruction.md index dd18e619980c2687fe4772d260bb316eee4672ae..e436f47e8c4723ef51db85ae04ee5cefa6717429 100644 --- a/tasks/agg-p17-n16-s07/instruction.md +++ b/tasks/agg-p17-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s07/tests/test.sh b/tasks/agg-p17-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s07/tests/test.sh +++ b/tasks/agg-p17-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s08/instruction.md b/tasks/agg-p17-n16-s08/instruction.md index 93b42da3c5ae14f9371e8643b81073fb0536e08a..366c2719a35a34f7a33d98415916d2080eb2b7e2 100644 --- a/tasks/agg-p17-n16-s08/instruction.md +++ b/tasks/agg-p17-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s08/tests/test.sh b/tasks/agg-p17-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s08/tests/test.sh +++ b/tasks/agg-p17-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s09/instruction.md b/tasks/agg-p17-n16-s09/instruction.md index c0f9d178a1c3057c8c4b57e9c5eca4e4c625b138..efa987bc861271d3fcd4cc6f1530e4d2ecbb6990 100644 --- a/tasks/agg-p17-n16-s09/instruction.md +++ b/tasks/agg-p17-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s09/tests/test.sh b/tasks/agg-p17-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s09/tests/test.sh +++ b/tasks/agg-p17-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s10/instruction.md b/tasks/agg-p17-n16-s10/instruction.md index ebbf18dd1885eca56e4b99d9ba0f301603987c59..967cbe42235491e28138a2858f78709704a1bd82 100644 --- a/tasks/agg-p17-n16-s10/instruction.md +++ b/tasks/agg-p17-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s10/tests/test.sh b/tasks/agg-p17-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s10/tests/test.sh +++ b/tasks/agg-p17-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s11/instruction.md b/tasks/agg-p17-n16-s11/instruction.md index bd54876511397bdb80a3c3299556503e1fd15da5..ffc3934425adafa34ada41ff5621db5d0f97a3bb 100644 --- a/tasks/agg-p17-n16-s11/instruction.md +++ b/tasks/agg-p17-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s11/tests/test.sh b/tasks/agg-p17-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s11/tests/test.sh +++ b/tasks/agg-p17-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s12/instruction.md b/tasks/agg-p17-n16-s12/instruction.md index 8ab72ec8e460e39a30835f1f318c6c784625ef7a..1cc6acc64c70683ec6b78f8bed55191c353726c4 100644 --- a/tasks/agg-p17-n16-s12/instruction.md +++ b/tasks/agg-p17-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s12/tests/test.sh b/tasks/agg-p17-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s12/tests/test.sh +++ b/tasks/agg-p17-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s13/instruction.md b/tasks/agg-p17-n16-s13/instruction.md index 1fc02ff38c01961e6ef2d04b50e560edacdcca90..1d5113c5dd5abf3bbd4601fe16ab16e11d5a8b7c 100644 --- a/tasks/agg-p17-n16-s13/instruction.md +++ b/tasks/agg-p17-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s13/tests/test.sh b/tasks/agg-p17-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s13/tests/test.sh +++ b/tasks/agg-p17-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s14/instruction.md b/tasks/agg-p17-n16-s14/instruction.md index d398ea97722601a49a457530f502678c0a1433cf..e1c1f7d3b01724d8dea774465c5f5d8397b1d161 100644 --- a/tasks/agg-p17-n16-s14/instruction.md +++ b/tasks/agg-p17-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s14/tests/test.sh b/tasks/agg-p17-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s14/tests/test.sh +++ b/tasks/agg-p17-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s15/instruction.md b/tasks/agg-p17-n16-s15/instruction.md index 93b42da3c5ae14f9371e8643b81073fb0536e08a..366c2719a35a34f7a33d98415916d2080eb2b7e2 100644 --- a/tasks/agg-p17-n16-s15/instruction.md +++ b/tasks/agg-p17-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s15/tests/test.sh b/tasks/agg-p17-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s15/tests/test.sh +++ b/tasks/agg-p17-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p17-n16-s16/instruction.md b/tasks/agg-p17-n16-s16/instruction.md index ebe30196b058cfe81ab8a53dd5461649bcf91202..7078e28d54452ae1cab8849d4648225bf8c92be9 100644 --- a/tasks/agg-p17-n16-s16/instruction.md +++ b/tasks/agg-p17-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p17-n16-s16/tests/test.sh b/tasks/agg-p17-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p17-n16-s16/tests/test.sh +++ b/tasks/agg-p17-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n01-s01/instruction.md b/tasks/agg-p18-n01-s01/instruction.md index 5b27e76624d136ae6d938388195789d67574ba7a..f9a522f49445772ee3fa7954172e91232646efaa 100644 --- a/tasks/agg-p18-n01-s01/instruction.md +++ b/tasks/agg-p18-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is seventy-two. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p18-n01-s01/tests/test.sh b/tasks/agg-p18-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n01-s01/tests/test.sh +++ b/tasks/agg-p18-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n02-s01/instruction.md b/tasks/agg-p18-n02-s01/instruction.md index 53004602a95dbebc4b28018a0922d5b31a5f4973..3437011b2201caa73ecb868637f9c5f2347e4283 100644 --- a/tasks/agg-p18-n02-s01/instruction.md +++ b/tasks/agg-p18-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n02-s01/tests/test.sh b/tasks/agg-p18-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n02-s01/tests/test.sh +++ b/tasks/agg-p18-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n02-s02/instruction.md b/tasks/agg-p18-n02-s02/instruction.md index 8f0260036f9f6a90ac1017e783859f85d56e776b..6e43c409ba242be431bf3f102ec0eeb3654affc2 100644 --- a/tasks/agg-p18-n02-s02/instruction.md +++ b/tasks/agg-p18-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n02-s02/tests/test.sh b/tasks/agg-p18-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n02-s02/tests/test.sh +++ b/tasks/agg-p18-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n04-s01/instruction.md b/tasks/agg-p18-n04-s01/instruction.md index 032aeb4ffceb27d8f0ee7c99b77d2ddd49bdf6f9..834ee27efe8af78fd1a92839343d263c7772851a 100644 --- a/tasks/agg-p18-n04-s01/instruction.md +++ b/tasks/agg-p18-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n04-s01/tests/test.sh b/tasks/agg-p18-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n04-s01/tests/test.sh +++ b/tasks/agg-p18-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n04-s02/instruction.md b/tasks/agg-p18-n04-s02/instruction.md index 1ea106cc729798f83e63ff87b48abf20a5b68cd1..4de2db7b4b3d57529f6bf1702ccfc114741b8e8e 100644 --- a/tasks/agg-p18-n04-s02/instruction.md +++ b/tasks/agg-p18-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n04-s02/tests/test.sh b/tasks/agg-p18-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n04-s02/tests/test.sh +++ b/tasks/agg-p18-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n04-s03/instruction.md b/tasks/agg-p18-n04-s03/instruction.md index 1e0005927fd30585d62f857e454dc88b98e7e051..eb145e3df9928587e5f03aa5bd4306f2a4925171 100644 --- a/tasks/agg-p18-n04-s03/instruction.md +++ b/tasks/agg-p18-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n04-s03/tests/test.sh b/tasks/agg-p18-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n04-s03/tests/test.sh +++ b/tasks/agg-p18-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n04-s04/instruction.md b/tasks/agg-p18-n04-s04/instruction.md index 5985fe79f84ad8d3bd05e5f2cb65788b96c4d962..80dc80a9b419d42463e357566022067b2538764b 100644 --- a/tasks/agg-p18-n04-s04/instruction.md +++ b/tasks/agg-p18-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n04-s04/tests/test.sh b/tasks/agg-p18-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n04-s04/tests/test.sh +++ b/tasks/agg-p18-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n06-s01/instruction.md b/tasks/agg-p18-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4f77c4d2d17e495ffb7a4f1bb01ae68be6cea39f --- /dev/null +++ b/tasks/agg-p18-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n06-s01/solution/solve.sh b/tasks/agg-p18-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..22f264e8e572a90040e98927b688f6f8c1ebb52a --- /dev/null +++ b/tasks/agg-p18-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 16, 59, 72, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n06-s01/task.toml b/tasks/agg-p18-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..dcadda25533b170643a44edd963396d58265c9c5 --- /dev/null +++ b/tasks/agg-p18-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n06-s01/tests/expected.json b/tasks/agg-p18-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f31d66479c8c31b64212acdbee337edbdad41919 --- /dev/null +++ b/tasks/agg-p18-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[1, 16, 59, 72, 84, 86] diff --git a/tasks/agg-p18-n06-s01/tests/test.sh b/tasks/agg-p18-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n06-s02/instruction.md b/tasks/agg-p18-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..adda75d0f97ef47d81a86e0535526bb33807bf60 --- /dev/null +++ b/tasks/agg-p18-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixteen. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n06-s02/solution/solve.sh b/tasks/agg-p18-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..22f264e8e572a90040e98927b688f6f8c1ebb52a --- /dev/null +++ b/tasks/agg-p18-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 16, 59, 72, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n06-s02/task.toml b/tasks/agg-p18-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0583d32a3a1d8fbc33cd0a13e664d4e1b3ed65ac --- /dev/null +++ b/tasks/agg-p18-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n06-s02/tests/expected.json b/tasks/agg-p18-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f31d66479c8c31b64212acdbee337edbdad41919 --- /dev/null +++ b/tasks/agg-p18-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[1, 16, 59, 72, 84, 86] diff --git a/tasks/agg-p18-n06-s02/tests/test.sh b/tasks/agg-p18-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n06-s03/instruction.md b/tasks/agg-p18-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..044902def78d0346c915e551662be15393efe3d7 --- /dev/null +++ b/tasks/agg-p18-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n06-s03/solution/solve.sh b/tasks/agg-p18-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..22f264e8e572a90040e98927b688f6f8c1ebb52a --- /dev/null +++ b/tasks/agg-p18-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 16, 59, 72, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n06-s03/task.toml b/tasks/agg-p18-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c090745b1b9ab2244f571070b9c110003f026eb6 --- /dev/null +++ b/tasks/agg-p18-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n06-s03/tests/expected.json b/tasks/agg-p18-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f31d66479c8c31b64212acdbee337edbdad41919 --- /dev/null +++ b/tasks/agg-p18-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[1, 16, 59, 72, 84, 86] diff --git a/tasks/agg-p18-n06-s03/tests/test.sh b/tasks/agg-p18-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n06-s04/instruction.md b/tasks/agg-p18-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7de047c5dfa2d2d4687c682be1e69dda63d15edb --- /dev/null +++ b/tasks/agg-p18-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n06-s04/solution/solve.sh b/tasks/agg-p18-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..22f264e8e572a90040e98927b688f6f8c1ebb52a --- /dev/null +++ b/tasks/agg-p18-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 16, 59, 72, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n06-s04/task.toml b/tasks/agg-p18-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..17dd9b114839b9a776dfc9aeecbf24e68b0c89f0 --- /dev/null +++ b/tasks/agg-p18-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n06-s04/tests/expected.json b/tasks/agg-p18-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f31d66479c8c31b64212acdbee337edbdad41919 --- /dev/null +++ b/tasks/agg-p18-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[1, 16, 59, 72, 84, 86] diff --git a/tasks/agg-p18-n06-s04/tests/test.sh b/tasks/agg-p18-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n06-s05/instruction.md b/tasks/agg-p18-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..236469f55d1122b675e853c110cf18d69bc97270 --- /dev/null +++ b/tasks/agg-p18-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n06-s05/solution/solve.sh b/tasks/agg-p18-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..22f264e8e572a90040e98927b688f6f8c1ebb52a --- /dev/null +++ b/tasks/agg-p18-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 16, 59, 72, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n06-s05/task.toml b/tasks/agg-p18-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c01833ae6b4c3acf586473ad83367bbb9c569037 --- /dev/null +++ b/tasks/agg-p18-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n06-s05/tests/expected.json b/tasks/agg-p18-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f31d66479c8c31b64212acdbee337edbdad41919 --- /dev/null +++ b/tasks/agg-p18-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[1, 16, 59, 72, 84, 86] diff --git a/tasks/agg-p18-n06-s05/tests/test.sh b/tasks/agg-p18-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n06-s06/instruction.md b/tasks/agg-p18-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..3dafee2b747502ef9be75b358aaa54e2d8323ba3 --- /dev/null +++ b/tasks/agg-p18-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n06-s06/solution/solve.sh b/tasks/agg-p18-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..22f264e8e572a90040e98927b688f6f8c1ebb52a --- /dev/null +++ b/tasks/agg-p18-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 16, 59, 72, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n06-s06/task.toml b/tasks/agg-p18-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7140402ba1e5da6ccd6d687f64a091c804aab3b5 --- /dev/null +++ b/tasks/agg-p18-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n06-s06/tests/expected.json b/tasks/agg-p18-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f31d66479c8c31b64212acdbee337edbdad41919 --- /dev/null +++ b/tasks/agg-p18-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[1, 16, 59, 72, 84, 86] diff --git a/tasks/agg-p18-n06-s06/tests/test.sh b/tasks/agg-p18-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n08-s01/instruction.md b/tasks/agg-p18-n08-s01/instruction.md index 12c157d6758e4be4e441fd6879e34f807d63305d..ee2e6b14f0bd1754e0f45ac89989f3eb396bc491 100644 --- a/tasks/agg-p18-n08-s01/instruction.md +++ b/tasks/agg-p18-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n08-s01/tests/test.sh b/tasks/agg-p18-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n08-s01/tests/test.sh +++ b/tasks/agg-p18-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n08-s02/instruction.md b/tasks/agg-p18-n08-s02/instruction.md index 9769af4be329d22f65faf77800d0debb38734a5c..0b31eb0bdfab7c5d2807b9c75e54f397599c9c11 100644 --- a/tasks/agg-p18-n08-s02/instruction.md +++ b/tasks/agg-p18-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n08-s02/tests/test.sh b/tasks/agg-p18-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n08-s02/tests/test.sh +++ b/tasks/agg-p18-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n08-s03/instruction.md b/tasks/agg-p18-n08-s03/instruction.md index 6662e6911ad1105e195cbc6e76b3cc8d9854bef3..d4b85483dd2dae073bb973b1851f38367afa7271 100644 --- a/tasks/agg-p18-n08-s03/instruction.md +++ b/tasks/agg-p18-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n08-s03/tests/test.sh b/tasks/agg-p18-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n08-s03/tests/test.sh +++ b/tasks/agg-p18-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n08-s04/instruction.md b/tasks/agg-p18-n08-s04/instruction.md index 886bc72662ab9eb339369a28cc3322cfbb3eaa89..b408160ded02b305a1041d2ca3291e96767416f1 100644 --- a/tasks/agg-p18-n08-s04/instruction.md +++ b/tasks/agg-p18-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n08-s04/tests/test.sh b/tasks/agg-p18-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n08-s04/tests/test.sh +++ b/tasks/agg-p18-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n08-s05/instruction.md b/tasks/agg-p18-n08-s05/instruction.md index e45426f396d954e1affff91de56f66666add7d1c..9ac975d854c3ed506df0f5fe496fd94a52739e55 100644 --- a/tasks/agg-p18-n08-s05/instruction.md +++ b/tasks/agg-p18-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n08-s05/tests/test.sh b/tasks/agg-p18-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n08-s05/tests/test.sh +++ b/tasks/agg-p18-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n08-s06/instruction.md b/tasks/agg-p18-n08-s06/instruction.md index b64a92e68353b9fc7a1f0fe39017de53c567f828..1908c1b4282d9c79f275510c40f0c40d5bc73072 100644 --- a/tasks/agg-p18-n08-s06/instruction.md +++ b/tasks/agg-p18-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n08-s06/tests/test.sh b/tasks/agg-p18-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n08-s06/tests/test.sh +++ b/tasks/agg-p18-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n08-s07/instruction.md b/tasks/agg-p18-n08-s07/instruction.md index 629e2ae1c728c40605589960cbd96dae496187c1..90998e7368407ace103b85ca771303d040de423a 100644 --- a/tasks/agg-p18-n08-s07/instruction.md +++ b/tasks/agg-p18-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n08-s07/tests/test.sh b/tasks/agg-p18-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n08-s07/tests/test.sh +++ b/tasks/agg-p18-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n08-s08/instruction.md b/tasks/agg-p18-n08-s08/instruction.md index b64a92e68353b9fc7a1f0fe39017de53c567f828..1908c1b4282d9c79f275510c40f0c40d5bc73072 100644 --- a/tasks/agg-p18-n08-s08/instruction.md +++ b/tasks/agg-p18-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n08-s08/tests/test.sh b/tasks/agg-p18-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n08-s08/tests/test.sh +++ b/tasks/agg-p18-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n12-s01/instruction.md b/tasks/agg-p18-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..93227a000a0fade57df7be54fe716ccf440f5a17 --- /dev/null +++ b/tasks/agg-p18-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n12-s01/solution/solve.sh b/tasks/agg-p18-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b34e65ae34aa309d86a01f400203800d59f8b03b --- /dev/null +++ b/tasks/agg-p18-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n12-s01/task.toml b/tasks/agg-p18-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a02a16cbb5fd8d390cdc3b7db8e9fd0df179d192 --- /dev/null +++ b/tasks/agg-p18-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n12-s01/tests/expected.json b/tasks/agg-p18-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ce2637c6a2b8c56aa01394f01fc026ae694fc3e --- /dev/null +++ b/tasks/agg-p18-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86] diff --git a/tasks/agg-p18-n12-s01/tests/test.sh b/tasks/agg-p18-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n12-s02/instruction.md b/tasks/agg-p18-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..183d4ee3e6b3a3123db0d338a5b1b7ad65451408 --- /dev/null +++ b/tasks/agg-p18-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n12-s02/solution/solve.sh b/tasks/agg-p18-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b34e65ae34aa309d86a01f400203800d59f8b03b --- /dev/null +++ b/tasks/agg-p18-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n12-s02/task.toml b/tasks/agg-p18-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a515332c5a3a3d1e75615e25bc052489748a4e80 --- /dev/null +++ b/tasks/agg-p18-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n12-s02/tests/expected.json b/tasks/agg-p18-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ce2637c6a2b8c56aa01394f01fc026ae694fc3e --- /dev/null +++ b/tasks/agg-p18-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86] diff --git a/tasks/agg-p18-n12-s02/tests/test.sh b/tasks/agg-p18-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n12-s03/instruction.md b/tasks/agg-p18-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..50b917cf08b6446450c1a43541739f4d5c2745bd --- /dev/null +++ b/tasks/agg-p18-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n12-s03/solution/solve.sh b/tasks/agg-p18-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b34e65ae34aa309d86a01f400203800d59f8b03b --- /dev/null +++ b/tasks/agg-p18-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n12-s03/task.toml b/tasks/agg-p18-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e4685cc8fa70d13dc3e4ae6083514266b71585c4 --- /dev/null +++ b/tasks/agg-p18-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n12-s03/tests/expected.json b/tasks/agg-p18-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ce2637c6a2b8c56aa01394f01fc026ae694fc3e --- /dev/null +++ b/tasks/agg-p18-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86] diff --git a/tasks/agg-p18-n12-s03/tests/test.sh b/tasks/agg-p18-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n12-s04/instruction.md b/tasks/agg-p18-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..71e4b46f8ef6c0e175e49cbd3404e539262eb6fd --- /dev/null +++ b/tasks/agg-p18-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n12-s04/solution/solve.sh b/tasks/agg-p18-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b34e65ae34aa309d86a01f400203800d59f8b03b --- /dev/null +++ b/tasks/agg-p18-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n12-s04/task.toml b/tasks/agg-p18-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0d34bb8b39002c54ddeed7610f1b1d96dface20c --- /dev/null +++ b/tasks/agg-p18-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n12-s04/tests/expected.json b/tasks/agg-p18-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ce2637c6a2b8c56aa01394f01fc026ae694fc3e --- /dev/null +++ b/tasks/agg-p18-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86] diff --git a/tasks/agg-p18-n12-s04/tests/test.sh b/tasks/agg-p18-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n12-s05/instruction.md b/tasks/agg-p18-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..858fd908139109c01cfa1d8e481e4eba9092e0b5 --- /dev/null +++ b/tasks/agg-p18-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n12-s05/solution/solve.sh b/tasks/agg-p18-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b34e65ae34aa309d86a01f400203800d59f8b03b --- /dev/null +++ b/tasks/agg-p18-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n12-s05/task.toml b/tasks/agg-p18-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..acec5d1bb2968b4d4ad646e3ff66d92901641e3e --- /dev/null +++ b/tasks/agg-p18-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n12-s05/tests/expected.json b/tasks/agg-p18-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ce2637c6a2b8c56aa01394f01fc026ae694fc3e --- /dev/null +++ b/tasks/agg-p18-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86] diff --git a/tasks/agg-p18-n12-s05/tests/test.sh b/tasks/agg-p18-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n12-s06/instruction.md b/tasks/agg-p18-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..aea24c74bafba54585041b7cfc69f546eb8451cd --- /dev/null +++ b/tasks/agg-p18-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n12-s06/solution/solve.sh b/tasks/agg-p18-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b34e65ae34aa309d86a01f400203800d59f8b03b --- /dev/null +++ b/tasks/agg-p18-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n12-s06/task.toml b/tasks/agg-p18-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d35edfdcf77b5fe9bff22a1839f0857946aed443 --- /dev/null +++ b/tasks/agg-p18-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n12-s06/tests/expected.json b/tasks/agg-p18-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ce2637c6a2b8c56aa01394f01fc026ae694fc3e --- /dev/null +++ b/tasks/agg-p18-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86] diff --git a/tasks/agg-p18-n12-s06/tests/test.sh b/tasks/agg-p18-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n12-s07/instruction.md b/tasks/agg-p18-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..afc44302e5446bbcbad60907a837f2fdde13fc15 --- /dev/null +++ b/tasks/agg-p18-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n12-s07/solution/solve.sh b/tasks/agg-p18-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b34e65ae34aa309d86a01f400203800d59f8b03b --- /dev/null +++ b/tasks/agg-p18-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n12-s07/task.toml b/tasks/agg-p18-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c5764f15eecad92f0ce0547e5ed4b534433c4d52 --- /dev/null +++ b/tasks/agg-p18-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n12-s07/tests/expected.json b/tasks/agg-p18-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ce2637c6a2b8c56aa01394f01fc026ae694fc3e --- /dev/null +++ b/tasks/agg-p18-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86] diff --git a/tasks/agg-p18-n12-s07/tests/test.sh b/tasks/agg-p18-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n12-s08/instruction.md b/tasks/agg-p18-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..aea24c74bafba54585041b7cfc69f546eb8451cd --- /dev/null +++ b/tasks/agg-p18-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n12-s08/solution/solve.sh b/tasks/agg-p18-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b34e65ae34aa309d86a01f400203800d59f8b03b --- /dev/null +++ b/tasks/agg-p18-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n12-s08/task.toml b/tasks/agg-p18-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..58c31f52bd38c7b3276264eaa53e07e16c79178f --- /dev/null +++ b/tasks/agg-p18-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n12-s08/tests/expected.json b/tasks/agg-p18-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ce2637c6a2b8c56aa01394f01fc026ae694fc3e --- /dev/null +++ b/tasks/agg-p18-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86] diff --git a/tasks/agg-p18-n12-s08/tests/test.sh b/tasks/agg-p18-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n12-s09/instruction.md b/tasks/agg-p18-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cb263587194e13f40f0ac806e2318a121b31d15a --- /dev/null +++ b/tasks/agg-p18-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n12-s09/solution/solve.sh b/tasks/agg-p18-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b34e65ae34aa309d86a01f400203800d59f8b03b --- /dev/null +++ b/tasks/agg-p18-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n12-s09/task.toml b/tasks/agg-p18-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4d51e233d31fe349a576f45e2670b1bffecc7a7b --- /dev/null +++ b/tasks/agg-p18-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n12-s09/tests/expected.json b/tasks/agg-p18-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ce2637c6a2b8c56aa01394f01fc026ae694fc3e --- /dev/null +++ b/tasks/agg-p18-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86] diff --git a/tasks/agg-p18-n12-s09/tests/test.sh b/tasks/agg-p18-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n12-s10/instruction.md b/tasks/agg-p18-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..894c08d452dd150a471307a3b982c78b62f7152f --- /dev/null +++ b/tasks/agg-p18-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n12-s10/solution/solve.sh b/tasks/agg-p18-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b34e65ae34aa309d86a01f400203800d59f8b03b --- /dev/null +++ b/tasks/agg-p18-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n12-s10/task.toml b/tasks/agg-p18-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f13f153143089451fe1c62977fc18656549f387d --- /dev/null +++ b/tasks/agg-p18-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n12-s10/tests/expected.json b/tasks/agg-p18-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ce2637c6a2b8c56aa01394f01fc026ae694fc3e --- /dev/null +++ b/tasks/agg-p18-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86] diff --git a/tasks/agg-p18-n12-s10/tests/test.sh b/tasks/agg-p18-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n12-s11/instruction.md b/tasks/agg-p18-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8cf648eaf9a4f546389931734c87680f9600280c --- /dev/null +++ b/tasks/agg-p18-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n12-s11/solution/solve.sh b/tasks/agg-p18-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b34e65ae34aa309d86a01f400203800d59f8b03b --- /dev/null +++ b/tasks/agg-p18-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n12-s11/task.toml b/tasks/agg-p18-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6c426b0eb8f788e497c251bdbb98086aaa642a3a --- /dev/null +++ b/tasks/agg-p18-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n12-s11/tests/expected.json b/tasks/agg-p18-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ce2637c6a2b8c56aa01394f01fc026ae694fc3e --- /dev/null +++ b/tasks/agg-p18-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86] diff --git a/tasks/agg-p18-n12-s11/tests/test.sh b/tasks/agg-p18-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n12-s12/instruction.md b/tasks/agg-p18-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6e844f7a3e8d345b3d28255a1eef90feb406b747 --- /dev/null +++ b/tasks/agg-p18-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n12-s12/solution/solve.sh b/tasks/agg-p18-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b34e65ae34aa309d86a01f400203800d59f8b03b --- /dev/null +++ b/tasks/agg-p18-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86]' > "$answer" diff --git a/tasks/agg-p18-n12-s12/task.toml b/tasks/agg-p18-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..324a47c5fcba563ad49e983cfe91e1b374fe6849 --- /dev/null +++ b/tasks/agg-p18-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p18-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 18 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p18-n12-s12/tests/expected.json b/tasks/agg-p18-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..1ce2637c6a2b8c56aa01394f01fc026ae694fc3e --- /dev/null +++ b/tasks/agg-p18-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 16, 43, 47, 59, 59, 66, 72, 83, 84, 86] diff --git a/tasks/agg-p18-n12-s12/tests/test.sh b/tasks/agg-p18-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p18-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p18-n16-s01/instruction.md b/tasks/agg-p18-n16-s01/instruction.md index 08f16c0341c376d61759335375d8e966ef70afb6..b1c2f8c471e4497bc3b40e61a030f9c69cc7f8d2 100644 --- a/tasks/agg-p18-n16-s01/instruction.md +++ b/tasks/agg-p18-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s01/tests/test.sh b/tasks/agg-p18-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s01/tests/test.sh +++ b/tasks/agg-p18-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s02/instruction.md b/tasks/agg-p18-n16-s02/instruction.md index 8e668cd99b85cf802939dffe8e766b769fcc702e..87e4a5f52a7382cfe533f0cb59ccf7425210c8fe 100644 --- a/tasks/agg-p18-n16-s02/instruction.md +++ b/tasks/agg-p18-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s02/tests/test.sh b/tasks/agg-p18-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s02/tests/test.sh +++ b/tasks/agg-p18-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s03/instruction.md b/tasks/agg-p18-n16-s03/instruction.md index 7d5ca093d11da3b866f85566039dbc2ac3bc8c84..7fe87dfffe4ad85e98cdbb07e05a77bf8a912afc 100644 --- a/tasks/agg-p18-n16-s03/instruction.md +++ b/tasks/agg-p18-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s03/tests/test.sh b/tasks/agg-p18-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s03/tests/test.sh +++ b/tasks/agg-p18-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s04/instruction.md b/tasks/agg-p18-n16-s04/instruction.md index 07c9e57a88a9821b15aef8e576670581ef52b8cf..f17e7c1550785116b92d6c8da78aeb05d8edf6c0 100644 --- a/tasks/agg-p18-n16-s04/instruction.md +++ b/tasks/agg-p18-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s04/tests/test.sh b/tasks/agg-p18-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s04/tests/test.sh +++ b/tasks/agg-p18-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s05/instruction.md b/tasks/agg-p18-n16-s05/instruction.md index 1a86ea7323aad3c91f00b65904f038f7e58f852d..d90a1687d9e29b3017d6bfd726c776fc6eece866 100644 --- a/tasks/agg-p18-n16-s05/instruction.md +++ b/tasks/agg-p18-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s05/tests/test.sh b/tasks/agg-p18-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s05/tests/test.sh +++ b/tasks/agg-p18-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s06/instruction.md b/tasks/agg-p18-n16-s06/instruction.md index 955b43d84b811b75405d52e1370487f6c7c7cb98..ddc7baf69b4eb80e25b3b08db2dfc6aa651b8b0b 100644 --- a/tasks/agg-p18-n16-s06/instruction.md +++ b/tasks/agg-p18-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s06/tests/test.sh b/tasks/agg-p18-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s06/tests/test.sh +++ b/tasks/agg-p18-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s07/instruction.md b/tasks/agg-p18-n16-s07/instruction.md index ebbf18dd1885eca56e4b99d9ba0f301603987c59..967cbe42235491e28138a2858f78709704a1bd82 100644 --- a/tasks/agg-p18-n16-s07/instruction.md +++ b/tasks/agg-p18-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s07/tests/test.sh b/tasks/agg-p18-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s07/tests/test.sh +++ b/tasks/agg-p18-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s08/instruction.md b/tasks/agg-p18-n16-s08/instruction.md index 955b43d84b811b75405d52e1370487f6c7c7cb98..ddc7baf69b4eb80e25b3b08db2dfc6aa651b8b0b 100644 --- a/tasks/agg-p18-n16-s08/instruction.md +++ b/tasks/agg-p18-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s08/tests/test.sh b/tasks/agg-p18-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s08/tests/test.sh +++ b/tasks/agg-p18-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s09/instruction.md b/tasks/agg-p18-n16-s09/instruction.md index b591b84320df9e123e22bd4301725691d49ea0a1..7f4d0ff076a0dba3c67021ed8791edf69a2b7c7b 100644 --- a/tasks/agg-p18-n16-s09/instruction.md +++ b/tasks/agg-p18-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s09/tests/test.sh b/tasks/agg-p18-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s09/tests/test.sh +++ b/tasks/agg-p18-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s10/instruction.md b/tasks/agg-p18-n16-s10/instruction.md index c0f9d178a1c3057c8c4b57e9c5eca4e4c625b138..efa987bc861271d3fcd4cc6f1530e4d2ecbb6990 100644 --- a/tasks/agg-p18-n16-s10/instruction.md +++ b/tasks/agg-p18-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s10/tests/test.sh b/tasks/agg-p18-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s10/tests/test.sh +++ b/tasks/agg-p18-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s11/instruction.md b/tasks/agg-p18-n16-s11/instruction.md index c83294206c6f7c5e973e8c218e0400911f653718..eef9c3edc8c0ed8aa6993d11f969e7bfdcc9dd6e 100644 --- a/tasks/agg-p18-n16-s11/instruction.md +++ b/tasks/agg-p18-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s11/tests/test.sh b/tasks/agg-p18-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s11/tests/test.sh +++ b/tasks/agg-p18-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s12/instruction.md b/tasks/agg-p18-n16-s12/instruction.md index bec568d59f85e2e30c1eb04f810b7ec136113a04..d047a7120223676abdd7f02b0240a56c724e3fff 100644 --- a/tasks/agg-p18-n16-s12/instruction.md +++ b/tasks/agg-p18-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s12/tests/test.sh b/tasks/agg-p18-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s12/tests/test.sh +++ b/tasks/agg-p18-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s13/instruction.md b/tasks/agg-p18-n16-s13/instruction.md index 5c5d544b57ab574592871eba4a9cf1c900af41ae..fcbafd4a7228b70ba628c7a82d64679c3d4fad1c 100644 --- a/tasks/agg-p18-n16-s13/instruction.md +++ b/tasks/agg-p18-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s13/tests/test.sh b/tasks/agg-p18-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s13/tests/test.sh +++ b/tasks/agg-p18-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s14/instruction.md b/tasks/agg-p18-n16-s14/instruction.md index 756b66e7e1661b13390451604d8a217c6028d32d..0d5d43f3e734b37862973953434a82fefb583200 100644 --- a/tasks/agg-p18-n16-s14/instruction.md +++ b/tasks/agg-p18-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s14/tests/test.sh b/tasks/agg-p18-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s14/tests/test.sh +++ b/tasks/agg-p18-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s15/instruction.md b/tasks/agg-p18-n16-s15/instruction.md index bb8416d585abe15f78ad9eaf98f78cbb202e2f9a..d2b26950540de67dd00f1a8d6c3d9b9c9c52ddf0 100644 --- a/tasks/agg-p18-n16-s15/instruction.md +++ b/tasks/agg-p18-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s15/tests/test.sh b/tasks/agg-p18-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s15/tests/test.sh +++ b/tasks/agg-p18-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p18-n16-s16/instruction.md b/tasks/agg-p18-n16-s16/instruction.md index f9807e3dca090e22409202efda192d4a7b9f5ac5..f9190cd6f2d679efa59828aa0ffdff708c0d41ce 100644 --- a/tasks/agg-p18-n16-s16/instruction.md +++ b/tasks/agg-p18-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p18-n16-s16/tests/test.sh b/tasks/agg-p18-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p18-n16-s16/tests/test.sh +++ b/tasks/agg-p18-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n01-s01/instruction.md b/tasks/agg-p19-n01-s01/instruction.md index 8b183a410f6784b4c2401e33f3404029ba45b663..cfe0a5390fb2b6a15328ff2764e870f0aedbbb24 100644 --- a/tasks/agg-p19-n01-s01/instruction.md +++ b/tasks/agg-p19-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is thirty-seven. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p19-n01-s01/tests/test.sh b/tasks/agg-p19-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n01-s01/tests/test.sh +++ b/tasks/agg-p19-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n02-s01/instruction.md b/tasks/agg-p19-n02-s01/instruction.md index a0f5d6312615f15532c609835c393db0d12fe574..60942ac5c12598ab8f5115caa263a4e08a18a959 100644 --- a/tasks/agg-p19-n02-s01/instruction.md +++ b/tasks/agg-p19-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n02-s01/tests/test.sh b/tasks/agg-p19-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n02-s01/tests/test.sh +++ b/tasks/agg-p19-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n02-s02/instruction.md b/tasks/agg-p19-n02-s02/instruction.md index e3e80c37bab180b2ef5455dbd0b0166de1a2d083..11696124c7e6d314c11846f84adae3e3541b28e3 100644 --- a/tasks/agg-p19-n02-s02/instruction.md +++ b/tasks/agg-p19-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n02-s02/tests/test.sh b/tasks/agg-p19-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n02-s02/tests/test.sh +++ b/tasks/agg-p19-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n04-s01/instruction.md b/tasks/agg-p19-n04-s01/instruction.md index e277410d31e98e54fee347c8344a718ced81e639..a341ab49f244ade6a8766079f432438a2111a896 100644 --- a/tasks/agg-p19-n04-s01/instruction.md +++ b/tasks/agg-p19-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n04-s01/tests/test.sh b/tasks/agg-p19-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n04-s01/tests/test.sh +++ b/tasks/agg-p19-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n04-s02/instruction.md b/tasks/agg-p19-n04-s02/instruction.md index e7f8348abecf5d7454f8bf09c875b2d3c49e5020..31b1aa16067c8423c6c652f461050f923d204e39 100644 --- a/tasks/agg-p19-n04-s02/instruction.md +++ b/tasks/agg-p19-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n04-s02/tests/test.sh b/tasks/agg-p19-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n04-s02/tests/test.sh +++ b/tasks/agg-p19-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n04-s03/instruction.md b/tasks/agg-p19-n04-s03/instruction.md index 4c0d369afbdce61b2450a59e5cf7cee14e3e76cb..88e11a82a0fa78970110b784c4c2d6311a059e4d 100644 --- a/tasks/agg-p19-n04-s03/instruction.md +++ b/tasks/agg-p19-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n04-s03/tests/test.sh b/tasks/agg-p19-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n04-s03/tests/test.sh +++ b/tasks/agg-p19-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n04-s04/instruction.md b/tasks/agg-p19-n04-s04/instruction.md index 710f629ccf5142ea8ee0ed83d0f5e26f17b2a9f7..fda8fc5dde6070d9bbc81bec80fa565d092f5bb3 100644 --- a/tasks/agg-p19-n04-s04/instruction.md +++ b/tasks/agg-p19-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n04-s04/tests/test.sh b/tasks/agg-p19-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n04-s04/tests/test.sh +++ b/tasks/agg-p19-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n06-s01/instruction.md b/tasks/agg-p19-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b24b39ec78a0cf7e450c5ad8eba4aa7d5a4a5b36 --- /dev/null +++ b/tasks/agg-p19-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n06-s01/solution/solve.sh b/tasks/agg-p19-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bda25493d4915669a4f4a05e0642bbbf9e47d8c --- /dev/null +++ b/tasks/agg-p19-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 34, 37, 41, 62, 88]' > "$answer" diff --git a/tasks/agg-p19-n06-s01/task.toml b/tasks/agg-p19-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..138841536b2338db22b6941f0750df9358cbf757 --- /dev/null +++ b/tasks/agg-p19-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n06-s01/tests/expected.json b/tasks/agg-p19-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..322d3be7d463824ebf4490f41286e544a4602258 --- /dev/null +++ b/tasks/agg-p19-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[10, 34, 37, 41, 62, 88] diff --git a/tasks/agg-p19-n06-s01/tests/test.sh b/tasks/agg-p19-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n06-s02/instruction.md b/tasks/agg-p19-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b7c38aeb0facd7d0088fe3412efc8eda68a87539 --- /dev/null +++ b/tasks/agg-p19-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n06-s02/solution/solve.sh b/tasks/agg-p19-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bda25493d4915669a4f4a05e0642bbbf9e47d8c --- /dev/null +++ b/tasks/agg-p19-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 34, 37, 41, 62, 88]' > "$answer" diff --git a/tasks/agg-p19-n06-s02/task.toml b/tasks/agg-p19-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8acf0661e386f5c749ddd671f2eece04b881977c --- /dev/null +++ b/tasks/agg-p19-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n06-s02/tests/expected.json b/tasks/agg-p19-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..322d3be7d463824ebf4490f41286e544a4602258 --- /dev/null +++ b/tasks/agg-p19-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[10, 34, 37, 41, 62, 88] diff --git a/tasks/agg-p19-n06-s02/tests/test.sh b/tasks/agg-p19-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n06-s03/instruction.md b/tasks/agg-p19-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d127d29184f6fa8e30fc3dc698ba4c5c5b50aba8 --- /dev/null +++ b/tasks/agg-p19-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n06-s03/solution/solve.sh b/tasks/agg-p19-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bda25493d4915669a4f4a05e0642bbbf9e47d8c --- /dev/null +++ b/tasks/agg-p19-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 34, 37, 41, 62, 88]' > "$answer" diff --git a/tasks/agg-p19-n06-s03/task.toml b/tasks/agg-p19-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b79b2c2198dd71066e48b9da1e40967929c2a293 --- /dev/null +++ b/tasks/agg-p19-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n06-s03/tests/expected.json b/tasks/agg-p19-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..322d3be7d463824ebf4490f41286e544a4602258 --- /dev/null +++ b/tasks/agg-p19-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[10, 34, 37, 41, 62, 88] diff --git a/tasks/agg-p19-n06-s03/tests/test.sh b/tasks/agg-p19-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n06-s04/instruction.md b/tasks/agg-p19-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0fe2a8811c726ac28727f6150ebaf8ef2a18e8b4 --- /dev/null +++ b/tasks/agg-p19-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n06-s04/solution/solve.sh b/tasks/agg-p19-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bda25493d4915669a4f4a05e0642bbbf9e47d8c --- /dev/null +++ b/tasks/agg-p19-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 34, 37, 41, 62, 88]' > "$answer" diff --git a/tasks/agg-p19-n06-s04/task.toml b/tasks/agg-p19-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..38ef5d03d3929361183c05516a2a2eea1755bb59 --- /dev/null +++ b/tasks/agg-p19-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n06-s04/tests/expected.json b/tasks/agg-p19-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..322d3be7d463824ebf4490f41286e544a4602258 --- /dev/null +++ b/tasks/agg-p19-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[10, 34, 37, 41, 62, 88] diff --git a/tasks/agg-p19-n06-s04/tests/test.sh b/tasks/agg-p19-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n06-s05/instruction.md b/tasks/agg-p19-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..be9476d381b867bb1ea88e966f7ba0f961895c1d --- /dev/null +++ b/tasks/agg-p19-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n06-s05/solution/solve.sh b/tasks/agg-p19-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bda25493d4915669a4f4a05e0642bbbf9e47d8c --- /dev/null +++ b/tasks/agg-p19-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 34, 37, 41, 62, 88]' > "$answer" diff --git a/tasks/agg-p19-n06-s05/task.toml b/tasks/agg-p19-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7168cbf68fd912370f4a499663ce252c9dd3c8f0 --- /dev/null +++ b/tasks/agg-p19-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n06-s05/tests/expected.json b/tasks/agg-p19-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..322d3be7d463824ebf4490f41286e544a4602258 --- /dev/null +++ b/tasks/agg-p19-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[10, 34, 37, 41, 62, 88] diff --git a/tasks/agg-p19-n06-s05/tests/test.sh b/tasks/agg-p19-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n06-s06/instruction.md b/tasks/agg-p19-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..256d7bc176acffa7ed5394bf8edd738765e0d8b5 --- /dev/null +++ b/tasks/agg-p19-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ten. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n06-s06/solution/solve.sh b/tasks/agg-p19-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1bda25493d4915669a4f4a05e0642bbbf9e47d8c --- /dev/null +++ b/tasks/agg-p19-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 34, 37, 41, 62, 88]' > "$answer" diff --git a/tasks/agg-p19-n06-s06/task.toml b/tasks/agg-p19-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..63b85380e7c29997c47b21024927540571b6ab5b --- /dev/null +++ b/tasks/agg-p19-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n06-s06/tests/expected.json b/tasks/agg-p19-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..322d3be7d463824ebf4490f41286e544a4602258 --- /dev/null +++ b/tasks/agg-p19-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[10, 34, 37, 41, 62, 88] diff --git a/tasks/agg-p19-n06-s06/tests/test.sh b/tasks/agg-p19-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n08-s01/instruction.md b/tasks/agg-p19-n08-s01/instruction.md index d28771240990d9554944b9ef68d9203e0acd7f13..99290acfb8baa2927750e2841040ecf9ddb5f1fa 100644 --- a/tasks/agg-p19-n08-s01/instruction.md +++ b/tasks/agg-p19-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n08-s01/tests/test.sh b/tasks/agg-p19-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n08-s01/tests/test.sh +++ b/tasks/agg-p19-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n08-s02/instruction.md b/tasks/agg-p19-n08-s02/instruction.md index 46a1349e70b8fdbb194bd99242092f099a7c90c7..f2f920be4b55de49b27362f70eb78f5eaf332718 100644 --- a/tasks/agg-p19-n08-s02/instruction.md +++ b/tasks/agg-p19-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n08-s02/tests/test.sh b/tasks/agg-p19-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n08-s02/tests/test.sh +++ b/tasks/agg-p19-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n08-s03/instruction.md b/tasks/agg-p19-n08-s03/instruction.md index 1479c41de00fbbd2d26aad2aee1e7ce486083215..0112dc65c46753b81674029d63466bce37601f3f 100644 --- a/tasks/agg-p19-n08-s03/instruction.md +++ b/tasks/agg-p19-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n08-s03/tests/test.sh b/tasks/agg-p19-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n08-s03/tests/test.sh +++ b/tasks/agg-p19-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n08-s04/instruction.md b/tasks/agg-p19-n08-s04/instruction.md index 8fc5da9fd3f2fb4b928fc1ff5a73236e0d218b54..d868b319945fa8116452ca00f04e2b9e846d67e5 100644 --- a/tasks/agg-p19-n08-s04/instruction.md +++ b/tasks/agg-p19-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n08-s04/tests/test.sh b/tasks/agg-p19-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n08-s04/tests/test.sh +++ b/tasks/agg-p19-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n08-s05/instruction.md b/tasks/agg-p19-n08-s05/instruction.md index a5f3ae82b9ed774fab555b5a9460d52b073e0832..ae266db90c2c93b83e572a8051a598ead3e700b5 100644 --- a/tasks/agg-p19-n08-s05/instruction.md +++ b/tasks/agg-p19-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n08-s05/tests/test.sh b/tasks/agg-p19-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n08-s05/tests/test.sh +++ b/tasks/agg-p19-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n08-s06/instruction.md b/tasks/agg-p19-n08-s06/instruction.md index 51e8ab49392a4426a4d85f07881697d0fa17cfef..45a820a9f48be217b1d66384ffde4a92bc7e239f 100644 --- a/tasks/agg-p19-n08-s06/instruction.md +++ b/tasks/agg-p19-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n08-s06/tests/test.sh b/tasks/agg-p19-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n08-s06/tests/test.sh +++ b/tasks/agg-p19-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n08-s07/instruction.md b/tasks/agg-p19-n08-s07/instruction.md index cfd28188a178a5f820bd132665deb26a6bb181c9..4ecbeb7af5580eb469b9bc54604d3613b27a96ef 100644 --- a/tasks/agg-p19-n08-s07/instruction.md +++ b/tasks/agg-p19-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n08-s07/tests/test.sh b/tasks/agg-p19-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n08-s07/tests/test.sh +++ b/tasks/agg-p19-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n08-s08/instruction.md b/tasks/agg-p19-n08-s08/instruction.md index e5a9078e4c58d734bc89d35a1a10f88352728538..39e243af8207cc8b7adc554fc5ac12d75cb1895b 100644 --- a/tasks/agg-p19-n08-s08/instruction.md +++ b/tasks/agg-p19-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n08-s08/tests/test.sh b/tasks/agg-p19-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n08-s08/tests/test.sh +++ b/tasks/agg-p19-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n12-s01/instruction.md b/tasks/agg-p19-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f8a7f84dc10e74d2d1efa1c93d0465b237cf01e --- /dev/null +++ b/tasks/agg-p19-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n12-s01/solution/solve.sh b/tasks/agg-p19-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..458e193f47c71c79f5c3dfc9c3c345ae2cf3fd69 --- /dev/null +++ b/tasks/agg-p19-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88]' > "$answer" diff --git a/tasks/agg-p19-n12-s01/task.toml b/tasks/agg-p19-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c6d1c3a6b82f7f78bebac74cd8a491f65f6be88f --- /dev/null +++ b/tasks/agg-p19-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n12-s01/tests/expected.json b/tasks/agg-p19-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..907488c5e5a57fc871ea40eaddcbce7cd666177d --- /dev/null +++ b/tasks/agg-p19-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88] diff --git a/tasks/agg-p19-n12-s01/tests/test.sh b/tasks/agg-p19-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n12-s02/instruction.md b/tasks/agg-p19-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f3a02bb6e52e493404bcac9983ca2aabf003220d --- /dev/null +++ b/tasks/agg-p19-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n12-s02/solution/solve.sh b/tasks/agg-p19-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..458e193f47c71c79f5c3dfc9c3c345ae2cf3fd69 --- /dev/null +++ b/tasks/agg-p19-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88]' > "$answer" diff --git a/tasks/agg-p19-n12-s02/task.toml b/tasks/agg-p19-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..448c7d7d59b5af07cb8b8c89d0b00ab81a6c2d24 --- /dev/null +++ b/tasks/agg-p19-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n12-s02/tests/expected.json b/tasks/agg-p19-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..907488c5e5a57fc871ea40eaddcbce7cd666177d --- /dev/null +++ b/tasks/agg-p19-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88] diff --git a/tasks/agg-p19-n12-s02/tests/test.sh b/tasks/agg-p19-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n12-s03/instruction.md b/tasks/agg-p19-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f378b007e7f5cf7bb24628ed10ac1fe1824109b7 --- /dev/null +++ b/tasks/agg-p19-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n12-s03/solution/solve.sh b/tasks/agg-p19-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..458e193f47c71c79f5c3dfc9c3c345ae2cf3fd69 --- /dev/null +++ b/tasks/agg-p19-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88]' > "$answer" diff --git a/tasks/agg-p19-n12-s03/task.toml b/tasks/agg-p19-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e0a67a8325531543a6991c9c2b402aaacdcd4957 --- /dev/null +++ b/tasks/agg-p19-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n12-s03/tests/expected.json b/tasks/agg-p19-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..907488c5e5a57fc871ea40eaddcbce7cd666177d --- /dev/null +++ b/tasks/agg-p19-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88] diff --git a/tasks/agg-p19-n12-s03/tests/test.sh b/tasks/agg-p19-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n12-s04/instruction.md b/tasks/agg-p19-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ca689d19db465172c22b2b5dc9acaa4689858529 --- /dev/null +++ b/tasks/agg-p19-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n12-s04/solution/solve.sh b/tasks/agg-p19-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..458e193f47c71c79f5c3dfc9c3c345ae2cf3fd69 --- /dev/null +++ b/tasks/agg-p19-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88]' > "$answer" diff --git a/tasks/agg-p19-n12-s04/task.toml b/tasks/agg-p19-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0e3fa8db2dd0401ebcc1591a7f739222b2772360 --- /dev/null +++ b/tasks/agg-p19-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n12-s04/tests/expected.json b/tasks/agg-p19-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..907488c5e5a57fc871ea40eaddcbce7cd666177d --- /dev/null +++ b/tasks/agg-p19-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88] diff --git a/tasks/agg-p19-n12-s04/tests/test.sh b/tasks/agg-p19-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n12-s05/instruction.md b/tasks/agg-p19-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f216e45e1729bdead394f5240fbbd01f063ca35a --- /dev/null +++ b/tasks/agg-p19-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n12-s05/solution/solve.sh b/tasks/agg-p19-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..458e193f47c71c79f5c3dfc9c3c345ae2cf3fd69 --- /dev/null +++ b/tasks/agg-p19-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88]' > "$answer" diff --git a/tasks/agg-p19-n12-s05/task.toml b/tasks/agg-p19-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6abac05a63a49ea71a76448a4033cfba8cbede91 --- /dev/null +++ b/tasks/agg-p19-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n12-s05/tests/expected.json b/tasks/agg-p19-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..907488c5e5a57fc871ea40eaddcbce7cd666177d --- /dev/null +++ b/tasks/agg-p19-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88] diff --git a/tasks/agg-p19-n12-s05/tests/test.sh b/tasks/agg-p19-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n12-s06/instruction.md b/tasks/agg-p19-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fecaa35f4770297f29a146761d64774bbee9ff8f --- /dev/null +++ b/tasks/agg-p19-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ten. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n12-s06/solution/solve.sh b/tasks/agg-p19-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..458e193f47c71c79f5c3dfc9c3c345ae2cf3fd69 --- /dev/null +++ b/tasks/agg-p19-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88]' > "$answer" diff --git a/tasks/agg-p19-n12-s06/task.toml b/tasks/agg-p19-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4067fcfd08fbbd2ff80cf063bd1b9e5b1c15f8e2 --- /dev/null +++ b/tasks/agg-p19-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n12-s06/tests/expected.json b/tasks/agg-p19-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..907488c5e5a57fc871ea40eaddcbce7cd666177d --- /dev/null +++ b/tasks/agg-p19-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88] diff --git a/tasks/agg-p19-n12-s06/tests/test.sh b/tasks/agg-p19-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n12-s07/instruction.md b/tasks/agg-p19-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8be11b5883f82241c1bfcc5354eaf615e8c586fb --- /dev/null +++ b/tasks/agg-p19-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n12-s07/solution/solve.sh b/tasks/agg-p19-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..458e193f47c71c79f5c3dfc9c3c345ae2cf3fd69 --- /dev/null +++ b/tasks/agg-p19-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88]' > "$answer" diff --git a/tasks/agg-p19-n12-s07/task.toml b/tasks/agg-p19-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..40f3290daae1a6ca0a35cd11f855c140ad19fe95 --- /dev/null +++ b/tasks/agg-p19-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n12-s07/tests/expected.json b/tasks/agg-p19-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..907488c5e5a57fc871ea40eaddcbce7cd666177d --- /dev/null +++ b/tasks/agg-p19-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88] diff --git a/tasks/agg-p19-n12-s07/tests/test.sh b/tasks/agg-p19-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n12-s08/instruction.md b/tasks/agg-p19-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9d09fce34dd764ef615193ac1a5121b1d8ac297a --- /dev/null +++ b/tasks/agg-p19-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n12-s08/solution/solve.sh b/tasks/agg-p19-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..458e193f47c71c79f5c3dfc9c3c345ae2cf3fd69 --- /dev/null +++ b/tasks/agg-p19-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88]' > "$answer" diff --git a/tasks/agg-p19-n12-s08/task.toml b/tasks/agg-p19-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2e31f9311ec712a058d451484a577cdb71dcde7d --- /dev/null +++ b/tasks/agg-p19-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n12-s08/tests/expected.json b/tasks/agg-p19-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..907488c5e5a57fc871ea40eaddcbce7cd666177d --- /dev/null +++ b/tasks/agg-p19-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88] diff --git a/tasks/agg-p19-n12-s08/tests/test.sh b/tasks/agg-p19-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n12-s09/instruction.md b/tasks/agg-p19-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..03f9f9dd05581a99b586e1b1b2b4801743fafb2d --- /dev/null +++ b/tasks/agg-p19-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n12-s09/solution/solve.sh b/tasks/agg-p19-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..458e193f47c71c79f5c3dfc9c3c345ae2cf3fd69 --- /dev/null +++ b/tasks/agg-p19-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88]' > "$answer" diff --git a/tasks/agg-p19-n12-s09/task.toml b/tasks/agg-p19-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..dbf324d4f4010e09401b4f57ec9743afadaf957b --- /dev/null +++ b/tasks/agg-p19-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n12-s09/tests/expected.json b/tasks/agg-p19-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..907488c5e5a57fc871ea40eaddcbce7cd666177d --- /dev/null +++ b/tasks/agg-p19-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88] diff --git a/tasks/agg-p19-n12-s09/tests/test.sh b/tasks/agg-p19-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n12-s10/instruction.md b/tasks/agg-p19-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..83c5f678c22dac3906bb709f049b6407e3c59614 --- /dev/null +++ b/tasks/agg-p19-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n12-s10/solution/solve.sh b/tasks/agg-p19-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..458e193f47c71c79f5c3dfc9c3c345ae2cf3fd69 --- /dev/null +++ b/tasks/agg-p19-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88]' > "$answer" diff --git a/tasks/agg-p19-n12-s10/task.toml b/tasks/agg-p19-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..dfacf5d75df1b32697ec594c7d90b65ab8786285 --- /dev/null +++ b/tasks/agg-p19-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n12-s10/tests/expected.json b/tasks/agg-p19-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..907488c5e5a57fc871ea40eaddcbce7cd666177d --- /dev/null +++ b/tasks/agg-p19-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88] diff --git a/tasks/agg-p19-n12-s10/tests/test.sh b/tasks/agg-p19-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n12-s11/instruction.md b/tasks/agg-p19-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..118bd725edb89efa2a1d06b9a496624d12c54355 --- /dev/null +++ b/tasks/agg-p19-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n12-s11/solution/solve.sh b/tasks/agg-p19-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..458e193f47c71c79f5c3dfc9c3c345ae2cf3fd69 --- /dev/null +++ b/tasks/agg-p19-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88]' > "$answer" diff --git a/tasks/agg-p19-n12-s11/task.toml b/tasks/agg-p19-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..15ea6a9229fee0ec8b06ea234bb7696127e22976 --- /dev/null +++ b/tasks/agg-p19-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n12-s11/tests/expected.json b/tasks/agg-p19-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..907488c5e5a57fc871ea40eaddcbce7cd666177d --- /dev/null +++ b/tasks/agg-p19-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88] diff --git a/tasks/agg-p19-n12-s11/tests/test.sh b/tasks/agg-p19-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n12-s12/instruction.md b/tasks/agg-p19-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6f3f8fe41060e201182cc94c7cf026320c69b36b --- /dev/null +++ b/tasks/agg-p19-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n12-s12/solution/solve.sh b/tasks/agg-p19-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..458e193f47c71c79f5c3dfc9c3c345ae2cf3fd69 --- /dev/null +++ b/tasks/agg-p19-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88]' > "$answer" diff --git a/tasks/agg-p19-n12-s12/task.toml b/tasks/agg-p19-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b562619437b3a3efaa7fa718789dc2c186feec08 --- /dev/null +++ b/tasks/agg-p19-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p19-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 19 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p19-n12-s12/tests/expected.json b/tasks/agg-p19-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..907488c5e5a57fc871ea40eaddcbce7cd666177d --- /dev/null +++ b/tasks/agg-p19-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[10, 29, 34, 35, 37, 41, 62, 65, 69, 71, 81, 88] diff --git a/tasks/agg-p19-n12-s12/tests/test.sh b/tasks/agg-p19-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p19-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p19-n16-s01/instruction.md b/tasks/agg-p19-n16-s01/instruction.md index 10bcc3d169e35738b1fb80abb7316f9cd7c1b230..254a759d5a0113deb55448c366676577f275a1f1 100644 --- a/tasks/agg-p19-n16-s01/instruction.md +++ b/tasks/agg-p19-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s01/tests/test.sh b/tasks/agg-p19-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s01/tests/test.sh +++ b/tasks/agg-p19-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s02/instruction.md b/tasks/agg-p19-n16-s02/instruction.md index 356ad9a55f491febf5d0b5a7f08b59d72a30b581..eeb8d1d20be418011c3de786ceee7d8938bcc672 100644 --- a/tasks/agg-p19-n16-s02/instruction.md +++ b/tasks/agg-p19-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s02/tests/test.sh b/tasks/agg-p19-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s02/tests/test.sh +++ b/tasks/agg-p19-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s03/instruction.md b/tasks/agg-p19-n16-s03/instruction.md index 81fbf2c2720ed316086419e84cc080153e8dc4cd..2c7e0125bf7b6189a66b80f4f9f491784a6708e4 100644 --- a/tasks/agg-p19-n16-s03/instruction.md +++ b/tasks/agg-p19-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s03/tests/test.sh b/tasks/agg-p19-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s03/tests/test.sh +++ b/tasks/agg-p19-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s04/instruction.md b/tasks/agg-p19-n16-s04/instruction.md index f197f79da6e4638891b46f2053909c167ec13c32..856f7627093ea9ba708f7c4461f757925253fef9 100644 --- a/tasks/agg-p19-n16-s04/instruction.md +++ b/tasks/agg-p19-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s04/tests/test.sh b/tasks/agg-p19-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s04/tests/test.sh +++ b/tasks/agg-p19-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s05/instruction.md b/tasks/agg-p19-n16-s05/instruction.md index 8ab72ec8e460e39a30835f1f318c6c784625ef7a..1cc6acc64c70683ec6b78f8bed55191c353726c4 100644 --- a/tasks/agg-p19-n16-s05/instruction.md +++ b/tasks/agg-p19-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s05/tests/test.sh b/tasks/agg-p19-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s05/tests/test.sh +++ b/tasks/agg-p19-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s06/instruction.md b/tasks/agg-p19-n16-s06/instruction.md index 15dcbc6a01201bc29446da73c6532fccce6c79d2..ed78cbe54ff7c90674c657e53e6c6135b38c5fb4 100644 --- a/tasks/agg-p19-n16-s06/instruction.md +++ b/tasks/agg-p19-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s06/tests/test.sh b/tasks/agg-p19-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s06/tests/test.sh +++ b/tasks/agg-p19-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s07/instruction.md b/tasks/agg-p19-n16-s07/instruction.md index 7db3d283effcee2e29406da16a63a785bcffa3f6..bd72b4cb3ef80fa76d635dbc7ca834354ab9abf2 100644 --- a/tasks/agg-p19-n16-s07/instruction.md +++ b/tasks/agg-p19-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s07/tests/test.sh b/tasks/agg-p19-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s07/tests/test.sh +++ b/tasks/agg-p19-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s08/instruction.md b/tasks/agg-p19-n16-s08/instruction.md index c9f61576dcb8ea2769bc6b953c327b5baba2bb54..728715ff5a180904d17bdd4c6d3921ea7a2eb170 100644 --- a/tasks/agg-p19-n16-s08/instruction.md +++ b/tasks/agg-p19-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s08/tests/test.sh b/tasks/agg-p19-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s08/tests/test.sh +++ b/tasks/agg-p19-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s09/instruction.md b/tasks/agg-p19-n16-s09/instruction.md index 4256e6220fcaf944c5b8d19997e2ebfa14df1a3a..d942fe902e8c9e013e140b297a8130029e959c2e 100644 --- a/tasks/agg-p19-n16-s09/instruction.md +++ b/tasks/agg-p19-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s09/tests/test.sh b/tasks/agg-p19-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s09/tests/test.sh +++ b/tasks/agg-p19-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s10/instruction.md b/tasks/agg-p19-n16-s10/instruction.md index be22dd060dc917313859b782fc59371588c6eefe..1ae1c83f6310b28c94d56fb3f9788827f371c4c2 100644 --- a/tasks/agg-p19-n16-s10/instruction.md +++ b/tasks/agg-p19-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s10/tests/test.sh b/tasks/agg-p19-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s10/tests/test.sh +++ b/tasks/agg-p19-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s11/instruction.md b/tasks/agg-p19-n16-s11/instruction.md index 1fe2576f1a20a278b177c066abc20e44af6a4729..5a9e9eac10d0ea0b9cedb5eefc9f2ace5395d6a9 100644 --- a/tasks/agg-p19-n16-s11/instruction.md +++ b/tasks/agg-p19-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s11/tests/test.sh b/tasks/agg-p19-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s11/tests/test.sh +++ b/tasks/agg-p19-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s12/instruction.md b/tasks/agg-p19-n16-s12/instruction.md index 722dd06eb5b0a1781e34a4a84c87448b77da2a59..5e39eb31f3bfe02211382c86f30186b5bbd8d4ba 100644 --- a/tasks/agg-p19-n16-s12/instruction.md +++ b/tasks/agg-p19-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s12/tests/test.sh b/tasks/agg-p19-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s12/tests/test.sh +++ b/tasks/agg-p19-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s13/instruction.md b/tasks/agg-p19-n16-s13/instruction.md index 3c1a8c1b0c33b8354227b277a5b1885c3067b4d2..6a9948c4088c17e7b78a078e0010c060500c2e8e 100644 --- a/tasks/agg-p19-n16-s13/instruction.md +++ b/tasks/agg-p19-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s13/tests/test.sh b/tasks/agg-p19-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s13/tests/test.sh +++ b/tasks/agg-p19-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s14/instruction.md b/tasks/agg-p19-n16-s14/instruction.md index 66569f84ff1e26966d416028875821de3887ef59..d12c30e5be9a650558f31b2d4d8d71ec3df3c860 100644 --- a/tasks/agg-p19-n16-s14/instruction.md +++ b/tasks/agg-p19-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s14/tests/test.sh b/tasks/agg-p19-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s14/tests/test.sh +++ b/tasks/agg-p19-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s15/instruction.md b/tasks/agg-p19-n16-s15/instruction.md index ac5d07700d94f2ac8dcfe94fa7b7a0669218f24c..b6fbdfaa15c801714d533bc10b7c3a21161186fb 100644 --- a/tasks/agg-p19-n16-s15/instruction.md +++ b/tasks/agg-p19-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s15/tests/test.sh b/tasks/agg-p19-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s15/tests/test.sh +++ b/tasks/agg-p19-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p19-n16-s16/instruction.md b/tasks/agg-p19-n16-s16/instruction.md index cebfaeb748131e1409dea8040dd71bd8744f230b..f855e374529122b9a74995c685bdc0845b660076 100644 --- a/tasks/agg-p19-n16-s16/instruction.md +++ b/tasks/agg-p19-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p19-n16-s16/tests/test.sh b/tasks/agg-p19-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p19-n16-s16/tests/test.sh +++ b/tasks/agg-p19-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n01-s01/instruction.md b/tasks/agg-p20-n01-s01/instruction.md index ba0991b04fe4432f86e1bc68490c0925cd309123..96291df3a8253c6d55c2371a499c7790fb17e946 100644 --- a/tasks/agg-p20-n01-s01/instruction.md +++ b/tasks/agg-p20-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is forty-four. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p20-n01-s01/tests/test.sh b/tasks/agg-p20-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n01-s01/tests/test.sh +++ b/tasks/agg-p20-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n02-s01/instruction.md b/tasks/agg-p20-n02-s01/instruction.md index 0fbd052fed3e13cfceff4d07c4aa062e93442fa8..1dd3de84c01cd948a08ce4e472a763fd80a94d6b 100644 --- a/tasks/agg-p20-n02-s01/instruction.md +++ b/tasks/agg-p20-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n02-s01/tests/test.sh b/tasks/agg-p20-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n02-s01/tests/test.sh +++ b/tasks/agg-p20-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n02-s02/instruction.md b/tasks/agg-p20-n02-s02/instruction.md index dc2977c271869eade3d61d52477e43043990986c..d8f430c035de70ea10e55ed5f8c81d5a1868bf06 100644 --- a/tasks/agg-p20-n02-s02/instruction.md +++ b/tasks/agg-p20-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n02-s02/tests/test.sh b/tasks/agg-p20-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n02-s02/tests/test.sh +++ b/tasks/agg-p20-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n04-s01/instruction.md b/tasks/agg-p20-n04-s01/instruction.md index 4921c497e5aeedbc467d8325039aded3f2118521..426adff736b3a07fa98c9decf8a3b2099bce3be5 100644 --- a/tasks/agg-p20-n04-s01/instruction.md +++ b/tasks/agg-p20-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n04-s01/tests/test.sh b/tasks/agg-p20-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n04-s01/tests/test.sh +++ b/tasks/agg-p20-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n04-s02/instruction.md b/tasks/agg-p20-n04-s02/instruction.md index 0cbe6c2b01afe87410f6fa2747e597f3fc901daf..16c5a2ac77ed95c9b3518554b9fe5bc21e7b4661 100644 --- a/tasks/agg-p20-n04-s02/instruction.md +++ b/tasks/agg-p20-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n04-s02/tests/test.sh b/tasks/agg-p20-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n04-s02/tests/test.sh +++ b/tasks/agg-p20-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n04-s03/instruction.md b/tasks/agg-p20-n04-s03/instruction.md index 57844953b25edf19db718990c35fe23e43f95f7a..1db807b3251e3960507b5ac241bf4434dd57e761 100644 --- a/tasks/agg-p20-n04-s03/instruction.md +++ b/tasks/agg-p20-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n04-s03/tests/test.sh b/tasks/agg-p20-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n04-s03/tests/test.sh +++ b/tasks/agg-p20-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n04-s04/instruction.md b/tasks/agg-p20-n04-s04/instruction.md index 16706302237fc8392949449eb048f6bb027a022c..fffa58b02b15fcff7eee47d23096045d666f7865 100644 --- a/tasks/agg-p20-n04-s04/instruction.md +++ b/tasks/agg-p20-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n04-s04/tests/test.sh b/tasks/agg-p20-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n04-s04/tests/test.sh +++ b/tasks/agg-p20-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n06-s01/instruction.md b/tasks/agg-p20-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6dcbc105c872e1a8124f422226220a38a629c510 --- /dev/null +++ b/tasks/agg-p20-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n06-s01/solution/solve.sh b/tasks/agg-p20-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0504c369fc047fcb4c4542e609e3fb46a55a17d0 --- /dev/null +++ b/tasks/agg-p20-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[44, 45, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n06-s01/task.toml b/tasks/agg-p20-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3ab5d5b8e88d4e99472840cece96a349dfdcfff3 --- /dev/null +++ b/tasks/agg-p20-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n06-s01/tests/expected.json b/tasks/agg-p20-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ceb56b1a5943c4d6a8a90ea37e9972a6e2782d26 --- /dev/null +++ b/tasks/agg-p20-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[44, 45, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n06-s01/tests/test.sh b/tasks/agg-p20-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n06-s02/instruction.md b/tasks/agg-p20-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..56024a42b25de88e503a849ea137440b919aee68 --- /dev/null +++ b/tasks/agg-p20-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n06-s02/solution/solve.sh b/tasks/agg-p20-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0504c369fc047fcb4c4542e609e3fb46a55a17d0 --- /dev/null +++ b/tasks/agg-p20-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[44, 45, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n06-s02/task.toml b/tasks/agg-p20-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d93cce1e53315ce11b590a9a094acc623bf7e9d1 --- /dev/null +++ b/tasks/agg-p20-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n06-s02/tests/expected.json b/tasks/agg-p20-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ceb56b1a5943c4d6a8a90ea37e9972a6e2782d26 --- /dev/null +++ b/tasks/agg-p20-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[44, 45, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n06-s02/tests/test.sh b/tasks/agg-p20-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n06-s03/instruction.md b/tasks/agg-p20-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fb49187f26e2368e600222d3d58320c4d2c80ff9 --- /dev/null +++ b/tasks/agg-p20-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n06-s03/solution/solve.sh b/tasks/agg-p20-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0504c369fc047fcb4c4542e609e3fb46a55a17d0 --- /dev/null +++ b/tasks/agg-p20-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[44, 45, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n06-s03/task.toml b/tasks/agg-p20-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..91badc864b67722b62527f978889f24d2f2cbd07 --- /dev/null +++ b/tasks/agg-p20-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n06-s03/tests/expected.json b/tasks/agg-p20-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ceb56b1a5943c4d6a8a90ea37e9972a6e2782d26 --- /dev/null +++ b/tasks/agg-p20-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[44, 45, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n06-s03/tests/test.sh b/tasks/agg-p20-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n06-s04/instruction.md b/tasks/agg-p20-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..938ca4fa446ac3bc537124ef6fffa0d68ee759cb --- /dev/null +++ b/tasks/agg-p20-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n06-s04/solution/solve.sh b/tasks/agg-p20-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0504c369fc047fcb4c4542e609e3fb46a55a17d0 --- /dev/null +++ b/tasks/agg-p20-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[44, 45, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n06-s04/task.toml b/tasks/agg-p20-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..53a6b433bf622f159db89e5c8f085ee81057b604 --- /dev/null +++ b/tasks/agg-p20-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n06-s04/tests/expected.json b/tasks/agg-p20-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ceb56b1a5943c4d6a8a90ea37e9972a6e2782d26 --- /dev/null +++ b/tasks/agg-p20-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[44, 45, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n06-s04/tests/test.sh b/tasks/agg-p20-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n06-s05/instruction.md b/tasks/agg-p20-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b0c3f5788603e45c015a75bb3fdd94cbb6ca3d10 --- /dev/null +++ b/tasks/agg-p20-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n06-s05/solution/solve.sh b/tasks/agg-p20-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0504c369fc047fcb4c4542e609e3fb46a55a17d0 --- /dev/null +++ b/tasks/agg-p20-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[44, 45, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n06-s05/task.toml b/tasks/agg-p20-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3f8ca6e6c9613732cb940101b9491c14b94059dd --- /dev/null +++ b/tasks/agg-p20-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n06-s05/tests/expected.json b/tasks/agg-p20-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ceb56b1a5943c4d6a8a90ea37e9972a6e2782d26 --- /dev/null +++ b/tasks/agg-p20-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[44, 45, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n06-s05/tests/test.sh b/tasks/agg-p20-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n06-s06/instruction.md b/tasks/agg-p20-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e2baac9407f25a8a80dbe03ef2a2e62f6f6ad2c1 --- /dev/null +++ b/tasks/agg-p20-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n06-s06/solution/solve.sh b/tasks/agg-p20-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..0504c369fc047fcb4c4542e609e3fb46a55a17d0 --- /dev/null +++ b/tasks/agg-p20-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[44, 45, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n06-s06/task.toml b/tasks/agg-p20-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8f6a8c867ab4a5df472ff50faca60504fbc680d0 --- /dev/null +++ b/tasks/agg-p20-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n06-s06/tests/expected.json b/tasks/agg-p20-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ceb56b1a5943c4d6a8a90ea37e9972a6e2782d26 --- /dev/null +++ b/tasks/agg-p20-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[44, 45, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n06-s06/tests/test.sh b/tasks/agg-p20-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n08-s01/instruction.md b/tasks/agg-p20-n08-s01/instruction.md index fde113c01e4acfbeb8da7ffabf1e13aba553efcb..88ddcffb3959c9bd9103a75fdec6a10918b46528 100644 --- a/tasks/agg-p20-n08-s01/instruction.md +++ b/tasks/agg-p20-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n08-s01/tests/test.sh b/tasks/agg-p20-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n08-s01/tests/test.sh +++ b/tasks/agg-p20-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n08-s02/instruction.md b/tasks/agg-p20-n08-s02/instruction.md index ac3f976754721a0afc38f69e19af1e9379b5a5f2..2748249b79ef6166ba43aff9fdd05407d48af0e6 100644 --- a/tasks/agg-p20-n08-s02/instruction.md +++ b/tasks/agg-p20-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n08-s02/tests/test.sh b/tasks/agg-p20-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n08-s02/tests/test.sh +++ b/tasks/agg-p20-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n08-s03/instruction.md b/tasks/agg-p20-n08-s03/instruction.md index a3ced584309e5034e6a9df4caf622b2a0502c9a5..1500ba63997389cf4258334a4bee45b1f9b4ce39 100644 --- a/tasks/agg-p20-n08-s03/instruction.md +++ b/tasks/agg-p20-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n08-s03/tests/test.sh b/tasks/agg-p20-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n08-s03/tests/test.sh +++ b/tasks/agg-p20-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n08-s04/instruction.md b/tasks/agg-p20-n08-s04/instruction.md index 5dfaf37489d6796e9a47f9dfca5402a1e39e51c2..682c7dbeddcd1c70522b5a7ef3b28dc65cfad7d4 100644 --- a/tasks/agg-p20-n08-s04/instruction.md +++ b/tasks/agg-p20-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n08-s04/tests/test.sh b/tasks/agg-p20-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n08-s04/tests/test.sh +++ b/tasks/agg-p20-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n08-s05/instruction.md b/tasks/agg-p20-n08-s05/instruction.md index 7c109cd4ed8453a6b5a2f8e25324d7442a538dd5..63cb81cc7cd8df79b35989c57d33d53121b8e6da 100644 --- a/tasks/agg-p20-n08-s05/instruction.md +++ b/tasks/agg-p20-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n08-s05/tests/test.sh b/tasks/agg-p20-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n08-s05/tests/test.sh +++ b/tasks/agg-p20-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n08-s06/instruction.md b/tasks/agg-p20-n08-s06/instruction.md index 2af66d24dc696b132e6fd3eda0188f7a40c90b60..860958efbf695f34e33cd9d04c3d39b09cbfd196 100644 --- a/tasks/agg-p20-n08-s06/instruction.md +++ b/tasks/agg-p20-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n08-s06/tests/test.sh b/tasks/agg-p20-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n08-s06/tests/test.sh +++ b/tasks/agg-p20-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n08-s07/instruction.md b/tasks/agg-p20-n08-s07/instruction.md index ac3f976754721a0afc38f69e19af1e9379b5a5f2..2748249b79ef6166ba43aff9fdd05407d48af0e6 100644 --- a/tasks/agg-p20-n08-s07/instruction.md +++ b/tasks/agg-p20-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n08-s07/tests/test.sh b/tasks/agg-p20-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n08-s07/tests/test.sh +++ b/tasks/agg-p20-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n08-s08/instruction.md b/tasks/agg-p20-n08-s08/instruction.md index e62126a64149a24e7278e73a216c4b232e5a78b2..b71e2424ef5ce0937a35b4ebd2df423d133331cc 100644 --- a/tasks/agg-p20-n08-s08/instruction.md +++ b/tasks/agg-p20-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n08-s08/tests/test.sh b/tasks/agg-p20-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n08-s08/tests/test.sh +++ b/tasks/agg-p20-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n12-s01/instruction.md b/tasks/agg-p20-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..60de2988fff25a8c1506580c1ef0e053a02c16f7 --- /dev/null +++ b/tasks/agg-p20-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n12-s01/solution/solve.sh b/tasks/agg-p20-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..41ee9447b4cd8b58045feec9e3a5a6776cc14ec2 --- /dev/null +++ b/tasks/agg-p20-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n12-s01/task.toml b/tasks/agg-p20-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f99482eab2717ac140882905662693b452aa6c19 --- /dev/null +++ b/tasks/agg-p20-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n12-s01/tests/expected.json b/tasks/agg-p20-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4350a660bbc42406aa02d986dc83895584ed5ead --- /dev/null +++ b/tasks/agg-p20-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n12-s01/tests/test.sh b/tasks/agg-p20-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n12-s02/instruction.md b/tasks/agg-p20-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c6a91a1f79bd6d228b316441f459621de12405e1 --- /dev/null +++ b/tasks/agg-p20-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n12-s02/solution/solve.sh b/tasks/agg-p20-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..41ee9447b4cd8b58045feec9e3a5a6776cc14ec2 --- /dev/null +++ b/tasks/agg-p20-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n12-s02/task.toml b/tasks/agg-p20-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c785f4bdad768e22d8f47f331db599e92ed30b4e --- /dev/null +++ b/tasks/agg-p20-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n12-s02/tests/expected.json b/tasks/agg-p20-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4350a660bbc42406aa02d986dc83895584ed5ead --- /dev/null +++ b/tasks/agg-p20-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n12-s02/tests/test.sh b/tasks/agg-p20-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n12-s03/instruction.md b/tasks/agg-p20-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..743bbc1fd4537e0975bd4083d0616f86374f4dee --- /dev/null +++ b/tasks/agg-p20-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n12-s03/solution/solve.sh b/tasks/agg-p20-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..41ee9447b4cd8b58045feec9e3a5a6776cc14ec2 --- /dev/null +++ b/tasks/agg-p20-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n12-s03/task.toml b/tasks/agg-p20-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5e66ebf17148b7bcc082fff80aaf328c2b806b79 --- /dev/null +++ b/tasks/agg-p20-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n12-s03/tests/expected.json b/tasks/agg-p20-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4350a660bbc42406aa02d986dc83895584ed5ead --- /dev/null +++ b/tasks/agg-p20-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n12-s03/tests/test.sh b/tasks/agg-p20-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n12-s04/instruction.md b/tasks/agg-p20-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f7bc3051e09aa70b286064fc6302e7e968c525e --- /dev/null +++ b/tasks/agg-p20-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n12-s04/solution/solve.sh b/tasks/agg-p20-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..41ee9447b4cd8b58045feec9e3a5a6776cc14ec2 --- /dev/null +++ b/tasks/agg-p20-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n12-s04/task.toml b/tasks/agg-p20-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ee8c8950c7905e220cb2621354a0ef8ea6c5f997 --- /dev/null +++ b/tasks/agg-p20-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n12-s04/tests/expected.json b/tasks/agg-p20-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4350a660bbc42406aa02d986dc83895584ed5ead --- /dev/null +++ b/tasks/agg-p20-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n12-s04/tests/test.sh b/tasks/agg-p20-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n12-s05/instruction.md b/tasks/agg-p20-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..02901bb1828d807a2d28e8fb148344dbe048c353 --- /dev/null +++ b/tasks/agg-p20-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n12-s05/solution/solve.sh b/tasks/agg-p20-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..41ee9447b4cd8b58045feec9e3a5a6776cc14ec2 --- /dev/null +++ b/tasks/agg-p20-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n12-s05/task.toml b/tasks/agg-p20-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1c0723b069ee3e2879351dc093ff966fed08e609 --- /dev/null +++ b/tasks/agg-p20-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n12-s05/tests/expected.json b/tasks/agg-p20-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4350a660bbc42406aa02d986dc83895584ed5ead --- /dev/null +++ b/tasks/agg-p20-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n12-s05/tests/test.sh b/tasks/agg-p20-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n12-s06/instruction.md b/tasks/agg-p20-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..83c5f678c22dac3906bb709f049b6407e3c59614 --- /dev/null +++ b/tasks/agg-p20-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n12-s06/solution/solve.sh b/tasks/agg-p20-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..41ee9447b4cd8b58045feec9e3a5a6776cc14ec2 --- /dev/null +++ b/tasks/agg-p20-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n12-s06/task.toml b/tasks/agg-p20-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..370e4a7410fa0b911994b55a9657350eb997d611 --- /dev/null +++ b/tasks/agg-p20-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n12-s06/tests/expected.json b/tasks/agg-p20-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4350a660bbc42406aa02d986dc83895584ed5ead --- /dev/null +++ b/tasks/agg-p20-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n12-s06/tests/test.sh b/tasks/agg-p20-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n12-s07/instruction.md b/tasks/agg-p20-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c6a91a1f79bd6d228b316441f459621de12405e1 --- /dev/null +++ b/tasks/agg-p20-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n12-s07/solution/solve.sh b/tasks/agg-p20-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..41ee9447b4cd8b58045feec9e3a5a6776cc14ec2 --- /dev/null +++ b/tasks/agg-p20-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n12-s07/task.toml b/tasks/agg-p20-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..97c1d0b0d0bd7055e528b2779a370a52d368876b --- /dev/null +++ b/tasks/agg-p20-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n12-s07/tests/expected.json b/tasks/agg-p20-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4350a660bbc42406aa02d986dc83895584ed5ead --- /dev/null +++ b/tasks/agg-p20-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n12-s07/tests/test.sh b/tasks/agg-p20-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n12-s08/instruction.md b/tasks/agg-p20-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8b047c78be8ec74c45258c089b61fd8c92d01be1 --- /dev/null +++ b/tasks/agg-p20-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n12-s08/solution/solve.sh b/tasks/agg-p20-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..41ee9447b4cd8b58045feec9e3a5a6776cc14ec2 --- /dev/null +++ b/tasks/agg-p20-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n12-s08/task.toml b/tasks/agg-p20-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ca06c5baa9415e97164c7666a91702962cc89d0a --- /dev/null +++ b/tasks/agg-p20-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n12-s08/tests/expected.json b/tasks/agg-p20-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4350a660bbc42406aa02d986dc83895584ed5ead --- /dev/null +++ b/tasks/agg-p20-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n12-s08/tests/test.sh b/tasks/agg-p20-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n12-s09/instruction.md b/tasks/agg-p20-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9d09fce34dd764ef615193ac1a5121b1d8ac297a --- /dev/null +++ b/tasks/agg-p20-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n12-s09/solution/solve.sh b/tasks/agg-p20-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..41ee9447b4cd8b58045feec9e3a5a6776cc14ec2 --- /dev/null +++ b/tasks/agg-p20-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n12-s09/task.toml b/tasks/agg-p20-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..52b21aa290530a74b1d6ac9162e651eea2a173d9 --- /dev/null +++ b/tasks/agg-p20-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n12-s09/tests/expected.json b/tasks/agg-p20-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4350a660bbc42406aa02d986dc83895584ed5ead --- /dev/null +++ b/tasks/agg-p20-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n12-s09/tests/test.sh b/tasks/agg-p20-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n12-s10/instruction.md b/tasks/agg-p20-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..89a1678c978d8a496615bec8d74744ae635b59ec --- /dev/null +++ b/tasks/agg-p20-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n12-s10/solution/solve.sh b/tasks/agg-p20-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..41ee9447b4cd8b58045feec9e3a5a6776cc14ec2 --- /dev/null +++ b/tasks/agg-p20-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n12-s10/task.toml b/tasks/agg-p20-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..371f70084a64a3d92fbe7e9d9aa025307661ba0a --- /dev/null +++ b/tasks/agg-p20-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n12-s10/tests/expected.json b/tasks/agg-p20-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4350a660bbc42406aa02d986dc83895584ed5ead --- /dev/null +++ b/tasks/agg-p20-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n12-s10/tests/test.sh b/tasks/agg-p20-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n12-s11/instruction.md b/tasks/agg-p20-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5435b7812ef266a4e2ec6b0a93d3c306439294ba --- /dev/null +++ b/tasks/agg-p20-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n12-s11/solution/solve.sh b/tasks/agg-p20-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..41ee9447b4cd8b58045feec9e3a5a6776cc14ec2 --- /dev/null +++ b/tasks/agg-p20-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n12-s11/task.toml b/tasks/agg-p20-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f49ce22fee5c737b804baef5386e328e97859847 --- /dev/null +++ b/tasks/agg-p20-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n12-s11/tests/expected.json b/tasks/agg-p20-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4350a660bbc42406aa02d986dc83895584ed5ead --- /dev/null +++ b/tasks/agg-p20-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n12-s11/tests/test.sh b/tasks/agg-p20-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n12-s12/instruction.md b/tasks/agg-p20-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9b0eae8063e1419234bd5a4b5a1fded790f6da23 --- /dev/null +++ b/tasks/agg-p20-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n12-s12/solution/solve.sh b/tasks/agg-p20-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..41ee9447b4cd8b58045feec9e3a5a6776cc14ec2 --- /dev/null +++ b/tasks/agg-p20-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97]' > "$answer" diff --git a/tasks/agg-p20-n12-s12/task.toml b/tasks/agg-p20-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..06841967aab445e29514148675bdd40665fc98b3 --- /dev/null +++ b/tasks/agg-p20-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p20-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 20 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p20-n12-s12/tests/expected.json b/tasks/agg-p20-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4350a660bbc42406aa02d986dc83895584ed5ead --- /dev/null +++ b/tasks/agg-p20-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[5, 31, 44, 45, 58, 65, 68, 73, 73, 74, 81, 97] diff --git a/tasks/agg-p20-n12-s12/tests/test.sh b/tasks/agg-p20-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p20-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p20-n16-s01/instruction.md b/tasks/agg-p20-n16-s01/instruction.md index a31300409e75190524f2a237c2d0d6348715dc53..106160b98d71014a9eaa408fdaab716f872544a2 100644 --- a/tasks/agg-p20-n16-s01/instruction.md +++ b/tasks/agg-p20-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s01/tests/test.sh b/tasks/agg-p20-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s01/tests/test.sh +++ b/tasks/agg-p20-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s02/instruction.md b/tasks/agg-p20-n16-s02/instruction.md index 57ed1435e76bbf3118473fa8b3b4d8bd26d42701..60d1a7b8eaf4ac4dcc56be0c2220caf87906fc98 100644 --- a/tasks/agg-p20-n16-s02/instruction.md +++ b/tasks/agg-p20-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s02/tests/test.sh b/tasks/agg-p20-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s02/tests/test.sh +++ b/tasks/agg-p20-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s03/instruction.md b/tasks/agg-p20-n16-s03/instruction.md index 03acbc08880291cf4dacc5df318650e9c8d0e519..d9247c4c1b3fb63a80aa5e8b875de2a3f5be1b29 100644 --- a/tasks/agg-p20-n16-s03/instruction.md +++ b/tasks/agg-p20-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s03/tests/test.sh b/tasks/agg-p20-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s03/tests/test.sh +++ b/tasks/agg-p20-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s04/instruction.md b/tasks/agg-p20-n16-s04/instruction.md index bb8416d585abe15f78ad9eaf98f78cbb202e2f9a..d2b26950540de67dd00f1a8d6c3d9b9c9c52ddf0 100644 --- a/tasks/agg-p20-n16-s04/instruction.md +++ b/tasks/agg-p20-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s04/tests/test.sh b/tasks/agg-p20-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s04/tests/test.sh +++ b/tasks/agg-p20-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s05/instruction.md b/tasks/agg-p20-n16-s05/instruction.md index 2b88f98c808d50d8812e112db76251266368fe80..3162a9d23282256e321282ae9170e9de281da28f 100644 --- a/tasks/agg-p20-n16-s05/instruction.md +++ b/tasks/agg-p20-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s05/tests/test.sh b/tasks/agg-p20-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s05/tests/test.sh +++ b/tasks/agg-p20-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s06/instruction.md b/tasks/agg-p20-n16-s06/instruction.md index be22dd060dc917313859b782fc59371588c6eefe..1ae1c83f6310b28c94d56fb3f9788827f371c4c2 100644 --- a/tasks/agg-p20-n16-s06/instruction.md +++ b/tasks/agg-p20-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s06/tests/test.sh b/tasks/agg-p20-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s06/tests/test.sh +++ b/tasks/agg-p20-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s07/instruction.md b/tasks/agg-p20-n16-s07/instruction.md index 57ed1435e76bbf3118473fa8b3b4d8bd26d42701..60d1a7b8eaf4ac4dcc56be0c2220caf87906fc98 100644 --- a/tasks/agg-p20-n16-s07/instruction.md +++ b/tasks/agg-p20-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s07/tests/test.sh b/tasks/agg-p20-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s07/tests/test.sh +++ b/tasks/agg-p20-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s08/instruction.md b/tasks/agg-p20-n16-s08/instruction.md index e5c784e3be1e3c1c8c8931ac55ae2345c1d7e341..0132dbcb468155a843c8c2b7a4a9e6ca2be0c499 100644 --- a/tasks/agg-p20-n16-s08/instruction.md +++ b/tasks/agg-p20-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s08/tests/test.sh b/tasks/agg-p20-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s08/tests/test.sh +++ b/tasks/agg-p20-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s09/instruction.md b/tasks/agg-p20-n16-s09/instruction.md index c9f61576dcb8ea2769bc6b953c327b5baba2bb54..728715ff5a180904d17bdd4c6d3921ea7a2eb170 100644 --- a/tasks/agg-p20-n16-s09/instruction.md +++ b/tasks/agg-p20-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s09/tests/test.sh b/tasks/agg-p20-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s09/tests/test.sh +++ b/tasks/agg-p20-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s10/instruction.md b/tasks/agg-p20-n16-s10/instruction.md index a7f0266a5e6733a93cf24a409665e6e92f793dba..d4d40f859809c8e8513c129e910f96795729f446 100644 --- a/tasks/agg-p20-n16-s10/instruction.md +++ b/tasks/agg-p20-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s10/tests/test.sh b/tasks/agg-p20-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s10/tests/test.sh +++ b/tasks/agg-p20-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s11/instruction.md b/tasks/agg-p20-n16-s11/instruction.md index 1245386f0aba38aec1627364e9a0bdce0b3a3214..7a6abd7e671d0d5e514cf3a081a12822f3e1fa80 100644 --- a/tasks/agg-p20-n16-s11/instruction.md +++ b/tasks/agg-p20-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s11/tests/test.sh b/tasks/agg-p20-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s11/tests/test.sh +++ b/tasks/agg-p20-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s12/instruction.md b/tasks/agg-p20-n16-s12/instruction.md index 17dddcebb1a38d642707c9e410dad0c89d830fb7..b2dbec3d0f3048cf387c99c193a35cad3f00783a 100644 --- a/tasks/agg-p20-n16-s12/instruction.md +++ b/tasks/agg-p20-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s12/tests/test.sh b/tasks/agg-p20-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s12/tests/test.sh +++ b/tasks/agg-p20-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s13/instruction.md b/tasks/agg-p20-n16-s13/instruction.md index 72bbb260a72c8a03816a7f046d2bafe5f6b145f2..fe4f0325e372e3a12281df6aa7a7ff5ffc6e5d94 100644 --- a/tasks/agg-p20-n16-s13/instruction.md +++ b/tasks/agg-p20-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s13/tests/test.sh b/tasks/agg-p20-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s13/tests/test.sh +++ b/tasks/agg-p20-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s14/instruction.md b/tasks/agg-p20-n16-s14/instruction.md index 8e07e4d36fb62c2d2904ca839b34d4b0744c309f..e4175fb2ee970049448cc7af46e926ef2e770c0c 100644 --- a/tasks/agg-p20-n16-s14/instruction.md +++ b/tasks/agg-p20-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s14/tests/test.sh b/tasks/agg-p20-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s14/tests/test.sh +++ b/tasks/agg-p20-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s15/instruction.md b/tasks/agg-p20-n16-s15/instruction.md index 9e673d50df3d0049f8ebbc5f08e69f16f929b38f..f17a373aff362de5ccbc3d2752a0dc99bf30605b 100644 --- a/tasks/agg-p20-n16-s15/instruction.md +++ b/tasks/agg-p20-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s15/tests/test.sh b/tasks/agg-p20-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s15/tests/test.sh +++ b/tasks/agg-p20-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p20-n16-s16/instruction.md b/tasks/agg-p20-n16-s16/instruction.md index 4256e6220fcaf944c5b8d19997e2ebfa14df1a3a..d942fe902e8c9e013e140b297a8130029e959c2e 100644 --- a/tasks/agg-p20-n16-s16/instruction.md +++ b/tasks/agg-p20-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p20-n16-s16/tests/test.sh b/tasks/agg-p20-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p20-n16-s16/tests/test.sh +++ b/tasks/agg-p20-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n01-s01/instruction.md b/tasks/agg-p21-n01-s01/instruction.md index d0f0e6b222673535cd196b445cefae65ba3119d9..b576dbc20401915c88b747a986e0138974a26e70 100644 --- a/tasks/agg-p21-n01-s01/instruction.md +++ b/tasks/agg-p21-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is fifty-seven. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p21-n01-s01/tests/test.sh b/tasks/agg-p21-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n01-s01/tests/test.sh +++ b/tasks/agg-p21-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n02-s01/instruction.md b/tasks/agg-p21-n02-s01/instruction.md index d0c079aadc7b51ed5ab5d618947c54483b14c839..3202d1d1fa15eefbe1b773b32b73df522278bc63 100644 --- a/tasks/agg-p21-n02-s01/instruction.md +++ b/tasks/agg-p21-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n02-s01/tests/test.sh b/tasks/agg-p21-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n02-s01/tests/test.sh +++ b/tasks/agg-p21-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n02-s02/instruction.md b/tasks/agg-p21-n02-s02/instruction.md index d2ec7b3010392f4ac1a368f88204f93331dd0271..f1229634d6b4a13edeb98ee1bbabadb892a30272 100644 --- a/tasks/agg-p21-n02-s02/instruction.md +++ b/tasks/agg-p21-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n02-s02/tests/test.sh b/tasks/agg-p21-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n02-s02/tests/test.sh +++ b/tasks/agg-p21-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n04-s01/instruction.md b/tasks/agg-p21-n04-s01/instruction.md index 35d1afd72cf600540907b19cc7d078cb47d28575..8618ca7ba6b2772a607c481c7f8b5a903ba8794b 100644 --- a/tasks/agg-p21-n04-s01/instruction.md +++ b/tasks/agg-p21-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n04-s01/tests/test.sh b/tasks/agg-p21-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n04-s01/tests/test.sh +++ b/tasks/agg-p21-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n04-s02/instruction.md b/tasks/agg-p21-n04-s02/instruction.md index 4d2a16ff7bd6c5a8ff4e0e15ebfb25482e84cfb6..d77a7cecea4f4d36dee9c2a55ab5fb0743f0a7f7 100644 --- a/tasks/agg-p21-n04-s02/instruction.md +++ b/tasks/agg-p21-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n04-s02/tests/test.sh b/tasks/agg-p21-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n04-s02/tests/test.sh +++ b/tasks/agg-p21-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n04-s03/instruction.md b/tasks/agg-p21-n04-s03/instruction.md index 430467a8c33661604553077a8a27e968376d25e5..080d5e6688850a817b1442e6f0fdcbe6a87cf876 100644 --- a/tasks/agg-p21-n04-s03/instruction.md +++ b/tasks/agg-p21-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n04-s03/tests/test.sh b/tasks/agg-p21-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n04-s03/tests/test.sh +++ b/tasks/agg-p21-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n04-s04/instruction.md b/tasks/agg-p21-n04-s04/instruction.md index d7c0983e7b60e1f53199f27bf9a07958a789d9a4..984275c443cbe8e72e98b8a877db557a4322c6e7 100644 --- a/tasks/agg-p21-n04-s04/instruction.md +++ b/tasks/agg-p21-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n04-s04/tests/test.sh b/tasks/agg-p21-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n04-s04/tests/test.sh +++ b/tasks/agg-p21-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n06-s01/instruction.md b/tasks/agg-p21-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..28b2e9647b1848ba7e1eabdb72052ac17b1ace6c --- /dev/null +++ b/tasks/agg-p21-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n06-s01/solution/solve.sh b/tasks/agg-p21-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..75656cc3089ee9b86294c33669b22615de15a120 --- /dev/null +++ b/tasks/agg-p21-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[19, 34, 57, 68, 71, 82]' > "$answer" diff --git a/tasks/agg-p21-n06-s01/task.toml b/tasks/agg-p21-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..adc6916d7e5e61c339dd3e9d4a23818410db2d9a --- /dev/null +++ b/tasks/agg-p21-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n06-s01/tests/expected.json b/tasks/agg-p21-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..282ea5e21023e2d4e97346b1e98b6be5da0ac71e --- /dev/null +++ b/tasks/agg-p21-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[19, 34, 57, 68, 71, 82] diff --git a/tasks/agg-p21-n06-s01/tests/test.sh b/tasks/agg-p21-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n06-s02/instruction.md b/tasks/agg-p21-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..be9476d381b867bb1ea88e966f7ba0f961895c1d --- /dev/null +++ b/tasks/agg-p21-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n06-s02/solution/solve.sh b/tasks/agg-p21-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..75656cc3089ee9b86294c33669b22615de15a120 --- /dev/null +++ b/tasks/agg-p21-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[19, 34, 57, 68, 71, 82]' > "$answer" diff --git a/tasks/agg-p21-n06-s02/task.toml b/tasks/agg-p21-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c2fa4ecfbb0463f591ed599fffb714d482bd4ddc --- /dev/null +++ b/tasks/agg-p21-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n06-s02/tests/expected.json b/tasks/agg-p21-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..282ea5e21023e2d4e97346b1e98b6be5da0ac71e --- /dev/null +++ b/tasks/agg-p21-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[19, 34, 57, 68, 71, 82] diff --git a/tasks/agg-p21-n06-s02/tests/test.sh b/tasks/agg-p21-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n06-s03/instruction.md b/tasks/agg-p21-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c10b04dc835d0dca589f77fcc2261a294978adf2 --- /dev/null +++ b/tasks/agg-p21-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n06-s03/solution/solve.sh b/tasks/agg-p21-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..75656cc3089ee9b86294c33669b22615de15a120 --- /dev/null +++ b/tasks/agg-p21-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[19, 34, 57, 68, 71, 82]' > "$answer" diff --git a/tasks/agg-p21-n06-s03/task.toml b/tasks/agg-p21-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b0c0e50aa16c2765b51f2b25b9a794a04c67fff7 --- /dev/null +++ b/tasks/agg-p21-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n06-s03/tests/expected.json b/tasks/agg-p21-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..282ea5e21023e2d4e97346b1e98b6be5da0ac71e --- /dev/null +++ b/tasks/agg-p21-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[19, 34, 57, 68, 71, 82] diff --git a/tasks/agg-p21-n06-s03/tests/test.sh b/tasks/agg-p21-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n06-s04/instruction.md b/tasks/agg-p21-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1c5e23125c4fa293fd0f92edbbb3abcdd56d4c59 --- /dev/null +++ b/tasks/agg-p21-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n06-s04/solution/solve.sh b/tasks/agg-p21-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..75656cc3089ee9b86294c33669b22615de15a120 --- /dev/null +++ b/tasks/agg-p21-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[19, 34, 57, 68, 71, 82]' > "$answer" diff --git a/tasks/agg-p21-n06-s04/task.toml b/tasks/agg-p21-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c1992c6b29eb01aa2f6e5825e4fb14fd72410e52 --- /dev/null +++ b/tasks/agg-p21-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n06-s04/tests/expected.json b/tasks/agg-p21-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..282ea5e21023e2d4e97346b1e98b6be5da0ac71e --- /dev/null +++ b/tasks/agg-p21-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[19, 34, 57, 68, 71, 82] diff --git a/tasks/agg-p21-n06-s04/tests/test.sh b/tasks/agg-p21-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n06-s05/instruction.md b/tasks/agg-p21-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a3162e0c3af58aba4c255d22f35fe5415203df89 --- /dev/null +++ b/tasks/agg-p21-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is nineteen. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n06-s05/solution/solve.sh b/tasks/agg-p21-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..75656cc3089ee9b86294c33669b22615de15a120 --- /dev/null +++ b/tasks/agg-p21-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[19, 34, 57, 68, 71, 82]' > "$answer" diff --git a/tasks/agg-p21-n06-s05/task.toml b/tasks/agg-p21-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3c429e72ad18995f01c9c77e0694f70f8d88d331 --- /dev/null +++ b/tasks/agg-p21-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n06-s05/tests/expected.json b/tasks/agg-p21-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..282ea5e21023e2d4e97346b1e98b6be5da0ac71e --- /dev/null +++ b/tasks/agg-p21-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[19, 34, 57, 68, 71, 82] diff --git a/tasks/agg-p21-n06-s05/tests/test.sh b/tasks/agg-p21-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n06-s06/instruction.md b/tasks/agg-p21-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d8bab66eb3d5058caae65c9939daace434a1e497 --- /dev/null +++ b/tasks/agg-p21-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n06-s06/solution/solve.sh b/tasks/agg-p21-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..75656cc3089ee9b86294c33669b22615de15a120 --- /dev/null +++ b/tasks/agg-p21-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[19, 34, 57, 68, 71, 82]' > "$answer" diff --git a/tasks/agg-p21-n06-s06/task.toml b/tasks/agg-p21-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c80aea66c636ca4022855487c2e45082593d2321 --- /dev/null +++ b/tasks/agg-p21-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n06-s06/tests/expected.json b/tasks/agg-p21-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..282ea5e21023e2d4e97346b1e98b6be5da0ac71e --- /dev/null +++ b/tasks/agg-p21-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[19, 34, 57, 68, 71, 82] diff --git a/tasks/agg-p21-n06-s06/tests/test.sh b/tasks/agg-p21-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n08-s01/instruction.md b/tasks/agg-p21-n08-s01/instruction.md index 2d60bbf6673a6be4cd68c1d77ed23a488a7bf7bf..9ba01c27661d4440f16d9001c644bd0a79960e2c 100644 --- a/tasks/agg-p21-n08-s01/instruction.md +++ b/tasks/agg-p21-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n08-s01/tests/test.sh b/tasks/agg-p21-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n08-s01/tests/test.sh +++ b/tasks/agg-p21-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n08-s02/instruction.md b/tasks/agg-p21-n08-s02/instruction.md index a5f3ae82b9ed774fab555b5a9460d52b073e0832..ae266db90c2c93b83e572a8051a598ead3e700b5 100644 --- a/tasks/agg-p21-n08-s02/instruction.md +++ b/tasks/agg-p21-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n08-s02/tests/test.sh b/tasks/agg-p21-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n08-s02/tests/test.sh +++ b/tasks/agg-p21-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n08-s03/instruction.md b/tasks/agg-p21-n08-s03/instruction.md index b972a48112ea31bbb92b19d1817bc5119ac04601..f5506dd4b4102b3440ace8d4668dab6d0b4cb826 100644 --- a/tasks/agg-p21-n08-s03/instruction.md +++ b/tasks/agg-p21-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n08-s03/tests/test.sh b/tasks/agg-p21-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n08-s03/tests/test.sh +++ b/tasks/agg-p21-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n08-s04/instruction.md b/tasks/agg-p21-n08-s04/instruction.md index 45b59ec949464e2c81423a8f183e17974a93c05c..b0bcae2eeaf25f778f80af13790eba76351df62c 100644 --- a/tasks/agg-p21-n08-s04/instruction.md +++ b/tasks/agg-p21-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n08-s04/tests/test.sh b/tasks/agg-p21-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n08-s04/tests/test.sh +++ b/tasks/agg-p21-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n08-s05/instruction.md b/tasks/agg-p21-n08-s05/instruction.md index e9260e41c83d52ff81d0cd24ab3bbcb722f43da1..002ff3f87af341baf7f43668a34cdab1fe436a4d 100644 --- a/tasks/agg-p21-n08-s05/instruction.md +++ b/tasks/agg-p21-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n08-s05/tests/test.sh b/tasks/agg-p21-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n08-s05/tests/test.sh +++ b/tasks/agg-p21-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n08-s06/instruction.md b/tasks/agg-p21-n08-s06/instruction.md index e0a9ed87cd13d7f7ad66688fc91321b44512af39..39881fad07dce830eccfa9e268db7f0e1c5ba5bc 100644 --- a/tasks/agg-p21-n08-s06/instruction.md +++ b/tasks/agg-p21-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n08-s06/tests/test.sh b/tasks/agg-p21-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n08-s06/tests/test.sh +++ b/tasks/agg-p21-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n08-s07/instruction.md b/tasks/agg-p21-n08-s07/instruction.md index ac3f976754721a0afc38f69e19af1e9379b5a5f2..2748249b79ef6166ba43aff9fdd05407d48af0e6 100644 --- a/tasks/agg-p21-n08-s07/instruction.md +++ b/tasks/agg-p21-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n08-s07/tests/test.sh b/tasks/agg-p21-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n08-s07/tests/test.sh +++ b/tasks/agg-p21-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n08-s08/instruction.md b/tasks/agg-p21-n08-s08/instruction.md index 20c75cc16db467c29e541a706205beed9fbbe75d..fa30070f61094288c088b08bfc8b901d9e75a2c6 100644 --- a/tasks/agg-p21-n08-s08/instruction.md +++ b/tasks/agg-p21-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n08-s08/tests/test.sh b/tasks/agg-p21-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n08-s08/tests/test.sh +++ b/tasks/agg-p21-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n12-s01/instruction.md b/tasks/agg-p21-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2d2551d3f0f60676e1ee34e7c12f21100d6a7d1d --- /dev/null +++ b/tasks/agg-p21-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n12-s01/solution/solve.sh b/tasks/agg-p21-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8936f41ed6fbf3c65df4664a7cff0ca40525be6a --- /dev/null +++ b/tasks/agg-p21-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99]' > "$answer" diff --git a/tasks/agg-p21-n12-s01/task.toml b/tasks/agg-p21-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cceaaccc95cf669b76415b1b6068b2ed5fb582bb --- /dev/null +++ b/tasks/agg-p21-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n12-s01/tests/expected.json b/tasks/agg-p21-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ab7391ea082fa4c6abb4f0aa9bd22764de6f5a45 --- /dev/null +++ b/tasks/agg-p21-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99] diff --git a/tasks/agg-p21-n12-s01/tests/test.sh b/tasks/agg-p21-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n12-s02/instruction.md b/tasks/agg-p21-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f216e45e1729bdead394f5240fbbd01f063ca35a --- /dev/null +++ b/tasks/agg-p21-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n12-s02/solution/solve.sh b/tasks/agg-p21-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8936f41ed6fbf3c65df4664a7cff0ca40525be6a --- /dev/null +++ b/tasks/agg-p21-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99]' > "$answer" diff --git a/tasks/agg-p21-n12-s02/task.toml b/tasks/agg-p21-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e83d7ec42c889820ac6ee638be2e8ae102555dcc --- /dev/null +++ b/tasks/agg-p21-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n12-s02/tests/expected.json b/tasks/agg-p21-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ab7391ea082fa4c6abb4f0aa9bd22764de6f5a45 --- /dev/null +++ b/tasks/agg-p21-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99] diff --git a/tasks/agg-p21-n12-s02/tests/test.sh b/tasks/agg-p21-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n12-s03/instruction.md b/tasks/agg-p21-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6f3f8fe41060e201182cc94c7cf026320c69b36b --- /dev/null +++ b/tasks/agg-p21-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n12-s03/solution/solve.sh b/tasks/agg-p21-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8936f41ed6fbf3c65df4664a7cff0ca40525be6a --- /dev/null +++ b/tasks/agg-p21-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99]' > "$answer" diff --git a/tasks/agg-p21-n12-s03/task.toml b/tasks/agg-p21-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..10ef1494ad3e87c6c7f72a07cd9245c605c99882 --- /dev/null +++ b/tasks/agg-p21-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n12-s03/tests/expected.json b/tasks/agg-p21-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ab7391ea082fa4c6abb4f0aa9bd22764de6f5a45 --- /dev/null +++ b/tasks/agg-p21-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99] diff --git a/tasks/agg-p21-n12-s03/tests/test.sh b/tasks/agg-p21-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n12-s04/instruction.md b/tasks/agg-p21-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..89a1678c978d8a496615bec8d74744ae635b59ec --- /dev/null +++ b/tasks/agg-p21-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n12-s04/solution/solve.sh b/tasks/agg-p21-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8936f41ed6fbf3c65df4664a7cff0ca40525be6a --- /dev/null +++ b/tasks/agg-p21-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99]' > "$answer" diff --git a/tasks/agg-p21-n12-s04/task.toml b/tasks/agg-p21-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e2cbb1c4d827fcb821f940ae9de93bb5a44121cc --- /dev/null +++ b/tasks/agg-p21-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n12-s04/tests/expected.json b/tasks/agg-p21-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ab7391ea082fa4c6abb4f0aa9bd22764de6f5a45 --- /dev/null +++ b/tasks/agg-p21-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99] diff --git a/tasks/agg-p21-n12-s04/tests/test.sh b/tasks/agg-p21-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n12-s05/instruction.md b/tasks/agg-p21-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d20cc8cc1f1c9617a83e07868fc43399bd7b4a36 --- /dev/null +++ b/tasks/agg-p21-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is nineteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n12-s05/solution/solve.sh b/tasks/agg-p21-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8936f41ed6fbf3c65df4664a7cff0ca40525be6a --- /dev/null +++ b/tasks/agg-p21-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99]' > "$answer" diff --git a/tasks/agg-p21-n12-s05/task.toml b/tasks/agg-p21-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7ebf0faf64268cf23e3c364886a2d547144a74a6 --- /dev/null +++ b/tasks/agg-p21-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n12-s05/tests/expected.json b/tasks/agg-p21-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ab7391ea082fa4c6abb4f0aa9bd22764de6f5a45 --- /dev/null +++ b/tasks/agg-p21-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99] diff --git a/tasks/agg-p21-n12-s05/tests/test.sh b/tasks/agg-p21-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n12-s06/instruction.md b/tasks/agg-p21-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cf78bc234ac7165a12e4210d637bece975cb648e --- /dev/null +++ b/tasks/agg-p21-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n12-s06/solution/solve.sh b/tasks/agg-p21-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8936f41ed6fbf3c65df4664a7cff0ca40525be6a --- /dev/null +++ b/tasks/agg-p21-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99]' > "$answer" diff --git a/tasks/agg-p21-n12-s06/task.toml b/tasks/agg-p21-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..feb5b319c7db031bab37ebf92e1ccd009b6c0838 --- /dev/null +++ b/tasks/agg-p21-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n12-s06/tests/expected.json b/tasks/agg-p21-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ab7391ea082fa4c6abb4f0aa9bd22764de6f5a45 --- /dev/null +++ b/tasks/agg-p21-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99] diff --git a/tasks/agg-p21-n12-s06/tests/test.sh b/tasks/agg-p21-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n12-s07/instruction.md b/tasks/agg-p21-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c6a91a1f79bd6d228b316441f459621de12405e1 --- /dev/null +++ b/tasks/agg-p21-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n12-s07/solution/solve.sh b/tasks/agg-p21-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8936f41ed6fbf3c65df4664a7cff0ca40525be6a --- /dev/null +++ b/tasks/agg-p21-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99]' > "$answer" diff --git a/tasks/agg-p21-n12-s07/task.toml b/tasks/agg-p21-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..144455fffa2461105890998204e9144edcd29c1d --- /dev/null +++ b/tasks/agg-p21-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n12-s07/tests/expected.json b/tasks/agg-p21-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ab7391ea082fa4c6abb4f0aa9bd22764de6f5a45 --- /dev/null +++ b/tasks/agg-p21-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99] diff --git a/tasks/agg-p21-n12-s07/tests/test.sh b/tasks/agg-p21-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n12-s08/instruction.md b/tasks/agg-p21-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..40f3f7e13cfd3a8040e44274dd1b8429c6804923 --- /dev/null +++ b/tasks/agg-p21-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n12-s08/solution/solve.sh b/tasks/agg-p21-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8936f41ed6fbf3c65df4664a7cff0ca40525be6a --- /dev/null +++ b/tasks/agg-p21-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99]' > "$answer" diff --git a/tasks/agg-p21-n12-s08/task.toml b/tasks/agg-p21-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7f4ecbe8fa0d56fa51a4c3056c4f7441e1f171f8 --- /dev/null +++ b/tasks/agg-p21-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n12-s08/tests/expected.json b/tasks/agg-p21-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ab7391ea082fa4c6abb4f0aa9bd22764de6f5a45 --- /dev/null +++ b/tasks/agg-p21-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99] diff --git a/tasks/agg-p21-n12-s08/tests/test.sh b/tasks/agg-p21-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n12-s09/instruction.md b/tasks/agg-p21-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bc6ecc07cf5acdcd085bd56b2102f26cc68f534e --- /dev/null +++ b/tasks/agg-p21-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n12-s09/solution/solve.sh b/tasks/agg-p21-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8936f41ed6fbf3c65df4664a7cff0ca40525be6a --- /dev/null +++ b/tasks/agg-p21-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99]' > "$answer" diff --git a/tasks/agg-p21-n12-s09/task.toml b/tasks/agg-p21-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8e0874376435dbd45bf3d65c2a51d56437f790b7 --- /dev/null +++ b/tasks/agg-p21-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n12-s09/tests/expected.json b/tasks/agg-p21-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ab7391ea082fa4c6abb4f0aa9bd22764de6f5a45 --- /dev/null +++ b/tasks/agg-p21-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99] diff --git a/tasks/agg-p21-n12-s09/tests/test.sh b/tasks/agg-p21-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n12-s10/instruction.md b/tasks/agg-p21-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..93227a000a0fade57df7be54fe716ccf440f5a17 --- /dev/null +++ b/tasks/agg-p21-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n12-s10/solution/solve.sh b/tasks/agg-p21-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8936f41ed6fbf3c65df4664a7cff0ca40525be6a --- /dev/null +++ b/tasks/agg-p21-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99]' > "$answer" diff --git a/tasks/agg-p21-n12-s10/task.toml b/tasks/agg-p21-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..45c4579c667bf0191a490548ee2cb3dd63901881 --- /dev/null +++ b/tasks/agg-p21-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n12-s10/tests/expected.json b/tasks/agg-p21-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ab7391ea082fa4c6abb4f0aa9bd22764de6f5a45 --- /dev/null +++ b/tasks/agg-p21-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99] diff --git a/tasks/agg-p21-n12-s10/tests/test.sh b/tasks/agg-p21-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n12-s11/instruction.md b/tasks/agg-p21-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e2d2cc8e9bcc9cde703e8c6628f5b3a2b4377585 --- /dev/null +++ b/tasks/agg-p21-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n12-s11/solution/solve.sh b/tasks/agg-p21-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8936f41ed6fbf3c65df4664a7cff0ca40525be6a --- /dev/null +++ b/tasks/agg-p21-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99]' > "$answer" diff --git a/tasks/agg-p21-n12-s11/task.toml b/tasks/agg-p21-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ba8177ac45408d822b0bcb676c1618129d6c109a --- /dev/null +++ b/tasks/agg-p21-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n12-s11/tests/expected.json b/tasks/agg-p21-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ab7391ea082fa4c6abb4f0aa9bd22764de6f5a45 --- /dev/null +++ b/tasks/agg-p21-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99] diff --git a/tasks/agg-p21-n12-s11/tests/test.sh b/tasks/agg-p21-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n12-s12/instruction.md b/tasks/agg-p21-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..183d4ee3e6b3a3123db0d338a5b1b7ad65451408 --- /dev/null +++ b/tasks/agg-p21-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n12-s12/solution/solve.sh b/tasks/agg-p21-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8936f41ed6fbf3c65df4664a7cff0ca40525be6a --- /dev/null +++ b/tasks/agg-p21-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99]' > "$answer" diff --git a/tasks/agg-p21-n12-s12/task.toml b/tasks/agg-p21-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c196feba2cfe3289b7e7537236f3470c7ce9cdf6 --- /dev/null +++ b/tasks/agg-p21-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p21-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 21 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p21-n12-s12/tests/expected.json b/tasks/agg-p21-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..ab7391ea082fa4c6abb4f0aa9bd22764de6f5a45 --- /dev/null +++ b/tasks/agg-p21-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[16, 18, 19, 34, 39, 57, 68, 71, 72, 73, 82, 99] diff --git a/tasks/agg-p21-n12-s12/tests/test.sh b/tasks/agg-p21-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p21-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p21-n16-s01/instruction.md b/tasks/agg-p21-n16-s01/instruction.md index 842ab62762da159702eecd05bee6231e50b04d8f..3585f20798dad91576432b94fc5446156ebc4cbd 100644 --- a/tasks/agg-p21-n16-s01/instruction.md +++ b/tasks/agg-p21-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s01/tests/test.sh b/tasks/agg-p21-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s01/tests/test.sh +++ b/tasks/agg-p21-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s02/instruction.md b/tasks/agg-p21-n16-s02/instruction.md index 8ab72ec8e460e39a30835f1f318c6c784625ef7a..1cc6acc64c70683ec6b78f8bed55191c353726c4 100644 --- a/tasks/agg-p21-n16-s02/instruction.md +++ b/tasks/agg-p21-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s02/tests/test.sh b/tasks/agg-p21-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s02/tests/test.sh +++ b/tasks/agg-p21-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s03/instruction.md b/tasks/agg-p21-n16-s03/instruction.md index 722dd06eb5b0a1781e34a4a84c87448b77da2a59..5e39eb31f3bfe02211382c86f30186b5bbd8d4ba 100644 --- a/tasks/agg-p21-n16-s03/instruction.md +++ b/tasks/agg-p21-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s03/tests/test.sh b/tasks/agg-p21-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s03/tests/test.sh +++ b/tasks/agg-p21-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s04/instruction.md b/tasks/agg-p21-n16-s04/instruction.md index a7f0266a5e6733a93cf24a409665e6e92f793dba..d4d40f859809c8e8513c129e910f96795729f446 100644 --- a/tasks/agg-p21-n16-s04/instruction.md +++ b/tasks/agg-p21-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s04/tests/test.sh b/tasks/agg-p21-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s04/tests/test.sh +++ b/tasks/agg-p21-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s05/instruction.md b/tasks/agg-p21-n16-s05/instruction.md index 689dc52da259912a8583e539c40d32957d6e1982..9e4a131dc1a41521b0b243cd7a381ee18c406e61 100644 --- a/tasks/agg-p21-n16-s05/instruction.md +++ b/tasks/agg-p21-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s05/tests/test.sh b/tasks/agg-p21-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s05/tests/test.sh +++ b/tasks/agg-p21-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s06/instruction.md b/tasks/agg-p21-n16-s06/instruction.md index 8719f945164b6c7adba0eec9b9728be32d6bfe5e..10a630b21435ec8e620ae5e83c5dc41b678c1031 100644 --- a/tasks/agg-p21-n16-s06/instruction.md +++ b/tasks/agg-p21-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s06/tests/test.sh b/tasks/agg-p21-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s06/tests/test.sh +++ b/tasks/agg-p21-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s07/instruction.md b/tasks/agg-p21-n16-s07/instruction.md index 57ed1435e76bbf3118473fa8b3b4d8bd26d42701..60d1a7b8eaf4ac4dcc56be0c2220caf87906fc98 100644 --- a/tasks/agg-p21-n16-s07/instruction.md +++ b/tasks/agg-p21-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s07/tests/test.sh b/tasks/agg-p21-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s07/tests/test.sh +++ b/tasks/agg-p21-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s08/instruction.md b/tasks/agg-p21-n16-s08/instruction.md index e5e3f1447d4ff13fe5188dafc1b5104a3c8f0e59..f9fc0a05d4cbd2084dc7f80c349485aae4d72692 100644 --- a/tasks/agg-p21-n16-s08/instruction.md +++ b/tasks/agg-p21-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s08/tests/test.sh b/tasks/agg-p21-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s08/tests/test.sh +++ b/tasks/agg-p21-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s09/instruction.md b/tasks/agg-p21-n16-s09/instruction.md index 57c62f85ec1ef4f9ca9aa899d016621c4b04432a..e1bd267ed9ac9c4fbf94870756f771be1265779a 100644 --- a/tasks/agg-p21-n16-s09/instruction.md +++ b/tasks/agg-p21-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s09/tests/test.sh b/tasks/agg-p21-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s09/tests/test.sh +++ b/tasks/agg-p21-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s10/instruction.md b/tasks/agg-p21-n16-s10/instruction.md index 08f16c0341c376d61759335375d8e966ef70afb6..b1c2f8c471e4497bc3b40e61a030f9c69cc7f8d2 100644 --- a/tasks/agg-p21-n16-s10/instruction.md +++ b/tasks/agg-p21-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s10/tests/test.sh b/tasks/agg-p21-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s10/tests/test.sh +++ b/tasks/agg-p21-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s11/instruction.md b/tasks/agg-p21-n16-s11/instruction.md index d443699990b373083b3fdeb1d846a400fde6e65b..b08879079fe0758b0792198b043d2a59e2a911e2 100644 --- a/tasks/agg-p21-n16-s11/instruction.md +++ b/tasks/agg-p21-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s11/tests/test.sh b/tasks/agg-p21-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s11/tests/test.sh +++ b/tasks/agg-p21-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s12/instruction.md b/tasks/agg-p21-n16-s12/instruction.md index 8e668cd99b85cf802939dffe8e766b769fcc702e..87e4a5f52a7382cfe533f0cb59ccf7425210c8fe 100644 --- a/tasks/agg-p21-n16-s12/instruction.md +++ b/tasks/agg-p21-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s12/tests/test.sh b/tasks/agg-p21-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s12/tests/test.sh +++ b/tasks/agg-p21-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s13/instruction.md b/tasks/agg-p21-n16-s13/instruction.md index 1fc02ff38c01961e6ef2d04b50e560edacdcca90..1d5113c5dd5abf3bbd4601fe16ab16e11d5a8b7c 100644 --- a/tasks/agg-p21-n16-s13/instruction.md +++ b/tasks/agg-p21-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s13/tests/test.sh b/tasks/agg-p21-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s13/tests/test.sh +++ b/tasks/agg-p21-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s14/instruction.md b/tasks/agg-p21-n16-s14/instruction.md index 24cae7506709ba17884a6f8faefcffb0fa372426..9945eb9052cf9160c89519b7d1952d5ce19dacf8 100644 --- a/tasks/agg-p21-n16-s14/instruction.md +++ b/tasks/agg-p21-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s14/tests/test.sh b/tasks/agg-p21-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s14/tests/test.sh +++ b/tasks/agg-p21-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s15/instruction.md b/tasks/agg-p21-n16-s15/instruction.md index e2aae6c434553b6621935dc958a71837c92b10ea..d005433b088d7a11d7b322ea605ccb1cdbaff8e5 100644 --- a/tasks/agg-p21-n16-s15/instruction.md +++ b/tasks/agg-p21-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s15/tests/test.sh b/tasks/agg-p21-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s15/tests/test.sh +++ b/tasks/agg-p21-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p21-n16-s16/instruction.md b/tasks/agg-p21-n16-s16/instruction.md index c0f9d178a1c3057c8c4b57e9c5eca4e4c625b138..efa987bc861271d3fcd4cc6f1530e4d2ecbb6990 100644 --- a/tasks/agg-p21-n16-s16/instruction.md +++ b/tasks/agg-p21-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p21-n16-s16/tests/test.sh b/tasks/agg-p21-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p21-n16-s16/tests/test.sh +++ b/tasks/agg-p21-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n01-s01/instruction.md b/tasks/agg-p22-n01-s01/instruction.md index 434b39478401072254d7d350cfc2b92e26e9c2fe..059851731b7311cf36f4ff1ec43665c34d94fff1 100644 --- a/tasks/agg-p22-n01-s01/instruction.md +++ b/tasks/agg-p22-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is four. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p22-n01-s01/tests/test.sh b/tasks/agg-p22-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n01-s01/tests/test.sh +++ b/tasks/agg-p22-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n02-s01/instruction.md b/tasks/agg-p22-n02-s01/instruction.md index 5558c17c14a89a00159e446d4e87630cdcef1ba2..a8b621bf3fa95f099228795fb11e3df4509dadae 100644 --- a/tasks/agg-p22-n02-s01/instruction.md +++ b/tasks/agg-p22-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n02-s01/tests/test.sh b/tasks/agg-p22-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n02-s01/tests/test.sh +++ b/tasks/agg-p22-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n02-s02/instruction.md b/tasks/agg-p22-n02-s02/instruction.md index e3e80c37bab180b2ef5455dbd0b0166de1a2d083..11696124c7e6d314c11846f84adae3e3541b28e3 100644 --- a/tasks/agg-p22-n02-s02/instruction.md +++ b/tasks/agg-p22-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n02-s02/tests/test.sh b/tasks/agg-p22-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n02-s02/tests/test.sh +++ b/tasks/agg-p22-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n04-s01/instruction.md b/tasks/agg-p22-n04-s01/instruction.md index 4e0ea7af0cbf9f514ae40b7ebdeb8125d1ab0241..f638f78ced32ce4c34ebe7b9c35c5e4caf8ae14f 100644 --- a/tasks/agg-p22-n04-s01/instruction.md +++ b/tasks/agg-p22-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n04-s01/tests/test.sh b/tasks/agg-p22-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n04-s01/tests/test.sh +++ b/tasks/agg-p22-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n04-s02/instruction.md b/tasks/agg-p22-n04-s02/instruction.md index e7f8348abecf5d7454f8bf09c875b2d3c49e5020..31b1aa16067c8423c6c652f461050f923d204e39 100644 --- a/tasks/agg-p22-n04-s02/instruction.md +++ b/tasks/agg-p22-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n04-s02/tests/test.sh b/tasks/agg-p22-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n04-s02/tests/test.sh +++ b/tasks/agg-p22-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n04-s03/instruction.md b/tasks/agg-p22-n04-s03/instruction.md index 81a0e2fd2e64d966c96d1befbbd673045e4ca524..4b3ef872ced45fb8836a5587cf57951846e2bcff 100644 --- a/tasks/agg-p22-n04-s03/instruction.md +++ b/tasks/agg-p22-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n04-s03/tests/test.sh b/tasks/agg-p22-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n04-s03/tests/test.sh +++ b/tasks/agg-p22-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n04-s04/instruction.md b/tasks/agg-p22-n04-s04/instruction.md index 430467a8c33661604553077a8a27e968376d25e5..080d5e6688850a817b1442e6f0fdcbe6a87cf876 100644 --- a/tasks/agg-p22-n04-s04/instruction.md +++ b/tasks/agg-p22-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n04-s04/tests/test.sh b/tasks/agg-p22-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n04-s04/tests/test.sh +++ b/tasks/agg-p22-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n06-s01/instruction.md b/tasks/agg-p22-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..745b2ae16840e1bcb6509c8b0b1545c62eecc1f6 --- /dev/null +++ b/tasks/agg-p22-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n06-s01/solution/solve.sh b/tasks/agg-p22-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b8401fcb2d2525bea4de9eb13ac5e2333c7c0aee --- /dev/null +++ b/tasks/agg-p22-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 23, 41, 71, 89]' > "$answer" diff --git a/tasks/agg-p22-n06-s01/task.toml b/tasks/agg-p22-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..566af783a5db1147bb7d21d26ad5e6b5ad442483 --- /dev/null +++ b/tasks/agg-p22-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n06-s01/tests/expected.json b/tasks/agg-p22-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f61c0a5dfe5b8bc03c708ba6dad21491cd60ec31 --- /dev/null +++ b/tasks/agg-p22-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 23, 41, 71, 89] diff --git a/tasks/agg-p22-n06-s01/tests/test.sh b/tasks/agg-p22-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n06-s02/instruction.md b/tasks/agg-p22-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b7c38aeb0facd7d0088fe3412efc8eda68a87539 --- /dev/null +++ b/tasks/agg-p22-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n06-s02/solution/solve.sh b/tasks/agg-p22-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b8401fcb2d2525bea4de9eb13ac5e2333c7c0aee --- /dev/null +++ b/tasks/agg-p22-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 23, 41, 71, 89]' > "$answer" diff --git a/tasks/agg-p22-n06-s02/task.toml b/tasks/agg-p22-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c7c47e375796230889ef84eca8bd5188b7dddc6a --- /dev/null +++ b/tasks/agg-p22-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n06-s02/tests/expected.json b/tasks/agg-p22-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f61c0a5dfe5b8bc03c708ba6dad21491cd60ec31 --- /dev/null +++ b/tasks/agg-p22-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 23, 41, 71, 89] diff --git a/tasks/agg-p22-n06-s02/tests/test.sh b/tasks/agg-p22-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n06-s03/instruction.md b/tasks/agg-p22-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2c7e63e09fb5a7d331c35a5363d54211ebfc3f1e --- /dev/null +++ b/tasks/agg-p22-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n06-s03/solution/solve.sh b/tasks/agg-p22-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b8401fcb2d2525bea4de9eb13ac5e2333c7c0aee --- /dev/null +++ b/tasks/agg-p22-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 23, 41, 71, 89]' > "$answer" diff --git a/tasks/agg-p22-n06-s03/task.toml b/tasks/agg-p22-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4f089277fe06f12ed8973c2219320efe4f5ce4fc --- /dev/null +++ b/tasks/agg-p22-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n06-s03/tests/expected.json b/tasks/agg-p22-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f61c0a5dfe5b8bc03c708ba6dad21491cd60ec31 --- /dev/null +++ b/tasks/agg-p22-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 23, 41, 71, 89] diff --git a/tasks/agg-p22-n06-s03/tests/test.sh b/tasks/agg-p22-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n06-s04/instruction.md b/tasks/agg-p22-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c10b04dc835d0dca589f77fcc2261a294978adf2 --- /dev/null +++ b/tasks/agg-p22-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n06-s04/solution/solve.sh b/tasks/agg-p22-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b8401fcb2d2525bea4de9eb13ac5e2333c7c0aee --- /dev/null +++ b/tasks/agg-p22-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 23, 41, 71, 89]' > "$answer" diff --git a/tasks/agg-p22-n06-s04/task.toml b/tasks/agg-p22-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b0f92c6935d3573b70494a95dc6afda55809397c --- /dev/null +++ b/tasks/agg-p22-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n06-s04/tests/expected.json b/tasks/agg-p22-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f61c0a5dfe5b8bc03c708ba6dad21491cd60ec31 --- /dev/null +++ b/tasks/agg-p22-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 23, 41, 71, 89] diff --git a/tasks/agg-p22-n06-s04/tests/test.sh b/tasks/agg-p22-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n06-s05/instruction.md b/tasks/agg-p22-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..16ce88e278c54743f1986a3fcb6cf261130fd7ec --- /dev/null +++ b/tasks/agg-p22-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n06-s05/solution/solve.sh b/tasks/agg-p22-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b8401fcb2d2525bea4de9eb13ac5e2333c7c0aee --- /dev/null +++ b/tasks/agg-p22-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 23, 41, 71, 89]' > "$answer" diff --git a/tasks/agg-p22-n06-s05/task.toml b/tasks/agg-p22-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4521dcf402847ff64d7deec29063d06ff965a69c --- /dev/null +++ b/tasks/agg-p22-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n06-s05/tests/expected.json b/tasks/agg-p22-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f61c0a5dfe5b8bc03c708ba6dad21491cd60ec31 --- /dev/null +++ b/tasks/agg-p22-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 23, 41, 71, 89] diff --git a/tasks/agg-p22-n06-s05/tests/test.sh b/tasks/agg-p22-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n06-s06/instruction.md b/tasks/agg-p22-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..db46a85781c5f4b05255f5b663546479ae052559 --- /dev/null +++ b/tasks/agg-p22-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n06-s06/solution/solve.sh b/tasks/agg-p22-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b8401fcb2d2525bea4de9eb13ac5e2333c7c0aee --- /dev/null +++ b/tasks/agg-p22-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 23, 41, 71, 89]' > "$answer" diff --git a/tasks/agg-p22-n06-s06/task.toml b/tasks/agg-p22-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bd00852b9aa8a58e840499391ef817579ba164d3 --- /dev/null +++ b/tasks/agg-p22-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n06-s06/tests/expected.json b/tasks/agg-p22-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f61c0a5dfe5b8bc03c708ba6dad21491cd60ec31 --- /dev/null +++ b/tasks/agg-p22-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 23, 41, 71, 89] diff --git a/tasks/agg-p22-n06-s06/tests/test.sh b/tasks/agg-p22-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n08-s01/instruction.md b/tasks/agg-p22-n08-s01/instruction.md index 26ddb6283c1971f9d81edaec183ef7aadd75290a..3ac56c4ea8687b7dfe32e2c55bd3311e97d6944e 100644 --- a/tasks/agg-p22-n08-s01/instruction.md +++ b/tasks/agg-p22-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n08-s01/tests/test.sh b/tasks/agg-p22-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n08-s01/tests/test.sh +++ b/tasks/agg-p22-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n08-s02/instruction.md b/tasks/agg-p22-n08-s02/instruction.md index 46a1349e70b8fdbb194bd99242092f099a7c90c7..f2f920be4b55de49b27362f70eb78f5eaf332718 100644 --- a/tasks/agg-p22-n08-s02/instruction.md +++ b/tasks/agg-p22-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n08-s02/tests/test.sh b/tasks/agg-p22-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n08-s02/tests/test.sh +++ b/tasks/agg-p22-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n08-s03/instruction.md b/tasks/agg-p22-n08-s03/instruction.md index 3ef2ec7b4ffc263c27c3bece987fc632ef3cc457..bb55200f8e9216811174b4f1ef5eacfa2a976d3e 100644 --- a/tasks/agg-p22-n08-s03/instruction.md +++ b/tasks/agg-p22-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n08-s03/tests/test.sh b/tasks/agg-p22-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n08-s03/tests/test.sh +++ b/tasks/agg-p22-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n08-s04/instruction.md b/tasks/agg-p22-n08-s04/instruction.md index b972a48112ea31bbb92b19d1817bc5119ac04601..f5506dd4b4102b3440ace8d4668dab6d0b4cb826 100644 --- a/tasks/agg-p22-n08-s04/instruction.md +++ b/tasks/agg-p22-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n08-s04/tests/test.sh b/tasks/agg-p22-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n08-s04/tests/test.sh +++ b/tasks/agg-p22-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n08-s05/instruction.md b/tasks/agg-p22-n08-s05/instruction.md index 75a1841e2fc9e7879f1e791caf8e81f6f6010a03..12ba1f30aac4454bd67f28a075ba69aa537ce1a2 100644 --- a/tasks/agg-p22-n08-s05/instruction.md +++ b/tasks/agg-p22-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n08-s05/tests/test.sh b/tasks/agg-p22-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n08-s05/tests/test.sh +++ b/tasks/agg-p22-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n08-s06/instruction.md b/tasks/agg-p22-n08-s06/instruction.md index 5b14deaa7622dc83330db4194d812edbd5c8daec..93afa9364b0adb56c55e6be58f7c5120524812fd 100644 --- a/tasks/agg-p22-n08-s06/instruction.md +++ b/tasks/agg-p22-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n08-s06/tests/test.sh b/tasks/agg-p22-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n08-s06/tests/test.sh +++ b/tasks/agg-p22-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n08-s07/instruction.md b/tasks/agg-p22-n08-s07/instruction.md index 11013456f8a87c719ca915738bc00756fb205169..c4ccb59055f956c2c26131b3be7de4e5e691b2d4 100644 --- a/tasks/agg-p22-n08-s07/instruction.md +++ b/tasks/agg-p22-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n08-s07/tests/test.sh b/tasks/agg-p22-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n08-s07/tests/test.sh +++ b/tasks/agg-p22-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n08-s08/instruction.md b/tasks/agg-p22-n08-s08/instruction.md index 27a8e1bd50be0cdbb7d7c6e5b7370ea7a88e7623..1e33aeee51a9a4d728e4588929a0d66b9457a8bb 100644 --- a/tasks/agg-p22-n08-s08/instruction.md +++ b/tasks/agg-p22-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n08-s08/tests/test.sh b/tasks/agg-p22-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n08-s08/tests/test.sh +++ b/tasks/agg-p22-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n12-s01/instruction.md b/tasks/agg-p22-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..519523fa549585a9595ce676c83c5ebd96f5e138 --- /dev/null +++ b/tasks/agg-p22-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n12-s01/solution/solve.sh b/tasks/agg-p22-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4d26dd115a6a51baac7771614ce9c24be1394fe4 --- /dev/null +++ b/tasks/agg-p22-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89]' > "$answer" diff --git a/tasks/agg-p22-n12-s01/task.toml b/tasks/agg-p22-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..13538600a38dc5e8fa7df74d7280dc5e758423ce --- /dev/null +++ b/tasks/agg-p22-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n12-s01/tests/expected.json b/tasks/agg-p22-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0208a542906d77a899cc45439dbfe53936f90634 --- /dev/null +++ b/tasks/agg-p22-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89] diff --git a/tasks/agg-p22-n12-s01/tests/test.sh b/tasks/agg-p22-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n12-s02/instruction.md b/tasks/agg-p22-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f3a02bb6e52e493404bcac9983ca2aabf003220d --- /dev/null +++ b/tasks/agg-p22-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n12-s02/solution/solve.sh b/tasks/agg-p22-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4d26dd115a6a51baac7771614ce9c24be1394fe4 --- /dev/null +++ b/tasks/agg-p22-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89]' > "$answer" diff --git a/tasks/agg-p22-n12-s02/task.toml b/tasks/agg-p22-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a613e16a5c85cc3332a2b60f2fe83aab791fab6c --- /dev/null +++ b/tasks/agg-p22-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n12-s02/tests/expected.json b/tasks/agg-p22-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0208a542906d77a899cc45439dbfe53936f90634 --- /dev/null +++ b/tasks/agg-p22-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89] diff --git a/tasks/agg-p22-n12-s02/tests/test.sh b/tasks/agg-p22-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n12-s03/instruction.md b/tasks/agg-p22-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0409dcf29dd269b54d93ca84f2b9a827d9cf7d50 --- /dev/null +++ b/tasks/agg-p22-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n12-s03/solution/solve.sh b/tasks/agg-p22-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4d26dd115a6a51baac7771614ce9c24be1394fe4 --- /dev/null +++ b/tasks/agg-p22-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89]' > "$answer" diff --git a/tasks/agg-p22-n12-s03/task.toml b/tasks/agg-p22-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d3451f8ab6a6f7ad2f6787cd0feacd6be207eac2 --- /dev/null +++ b/tasks/agg-p22-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n12-s03/tests/expected.json b/tasks/agg-p22-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0208a542906d77a899cc45439dbfe53936f90634 --- /dev/null +++ b/tasks/agg-p22-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89] diff --git a/tasks/agg-p22-n12-s03/tests/test.sh b/tasks/agg-p22-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n12-s04/instruction.md b/tasks/agg-p22-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6f3f8fe41060e201182cc94c7cf026320c69b36b --- /dev/null +++ b/tasks/agg-p22-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n12-s04/solution/solve.sh b/tasks/agg-p22-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4d26dd115a6a51baac7771614ce9c24be1394fe4 --- /dev/null +++ b/tasks/agg-p22-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89]' > "$answer" diff --git a/tasks/agg-p22-n12-s04/task.toml b/tasks/agg-p22-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a915848f2e84196093256dae119a74ba462dac77 --- /dev/null +++ b/tasks/agg-p22-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n12-s04/tests/expected.json b/tasks/agg-p22-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0208a542906d77a899cc45439dbfe53936f90634 --- /dev/null +++ b/tasks/agg-p22-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89] diff --git a/tasks/agg-p22-n12-s04/tests/test.sh b/tasks/agg-p22-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n12-s05/instruction.md b/tasks/agg-p22-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9b0eae8063e1419234bd5a4b5a1fded790f6da23 --- /dev/null +++ b/tasks/agg-p22-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n12-s05/solution/solve.sh b/tasks/agg-p22-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4d26dd115a6a51baac7771614ce9c24be1394fe4 --- /dev/null +++ b/tasks/agg-p22-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89]' > "$answer" diff --git a/tasks/agg-p22-n12-s05/task.toml b/tasks/agg-p22-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c41fb9033b4cb42c484f42aeb9012343b87042d2 --- /dev/null +++ b/tasks/agg-p22-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n12-s05/tests/expected.json b/tasks/agg-p22-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0208a542906d77a899cc45439dbfe53936f90634 --- /dev/null +++ b/tasks/agg-p22-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89] diff --git a/tasks/agg-p22-n12-s05/tests/test.sh b/tasks/agg-p22-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n12-s06/instruction.md b/tasks/agg-p22-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1ec3d2a16079c4d9737f2784ae217eea77d88533 --- /dev/null +++ b/tasks/agg-p22-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n12-s06/solution/solve.sh b/tasks/agg-p22-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4d26dd115a6a51baac7771614ce9c24be1394fe4 --- /dev/null +++ b/tasks/agg-p22-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89]' > "$answer" diff --git a/tasks/agg-p22-n12-s06/task.toml b/tasks/agg-p22-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4e5c94022b8519227b7d733b218f8d46ae69b807 --- /dev/null +++ b/tasks/agg-p22-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n12-s06/tests/expected.json b/tasks/agg-p22-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0208a542906d77a899cc45439dbfe53936f90634 --- /dev/null +++ b/tasks/agg-p22-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89] diff --git a/tasks/agg-p22-n12-s06/tests/test.sh b/tasks/agg-p22-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n12-s07/instruction.md b/tasks/agg-p22-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8bf4e335a22d725c98824995a69927ae729ffac4 --- /dev/null +++ b/tasks/agg-p22-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n12-s07/solution/solve.sh b/tasks/agg-p22-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4d26dd115a6a51baac7771614ce9c24be1394fe4 --- /dev/null +++ b/tasks/agg-p22-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89]' > "$answer" diff --git a/tasks/agg-p22-n12-s07/task.toml b/tasks/agg-p22-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4f5811dfe682032f1fe40e0e610be1cf14a5435d --- /dev/null +++ b/tasks/agg-p22-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n12-s07/tests/expected.json b/tasks/agg-p22-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0208a542906d77a899cc45439dbfe53936f90634 --- /dev/null +++ b/tasks/agg-p22-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89] diff --git a/tasks/agg-p22-n12-s07/tests/test.sh b/tasks/agg-p22-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n12-s08/instruction.md b/tasks/agg-p22-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bcda533fb0b3407f78cfaf5c16a551ac6f72aead --- /dev/null +++ b/tasks/agg-p22-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n12-s08/solution/solve.sh b/tasks/agg-p22-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4d26dd115a6a51baac7771614ce9c24be1394fe4 --- /dev/null +++ b/tasks/agg-p22-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89]' > "$answer" diff --git a/tasks/agg-p22-n12-s08/task.toml b/tasks/agg-p22-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6df98cb7ea44d03a4c6031756fe0187ddbf7280d --- /dev/null +++ b/tasks/agg-p22-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n12-s08/tests/expected.json b/tasks/agg-p22-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0208a542906d77a899cc45439dbfe53936f90634 --- /dev/null +++ b/tasks/agg-p22-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89] diff --git a/tasks/agg-p22-n12-s08/tests/test.sh b/tasks/agg-p22-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n12-s09/instruction.md b/tasks/agg-p22-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5435b7812ef266a4e2ec6b0a93d3c306439294ba --- /dev/null +++ b/tasks/agg-p22-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n12-s09/solution/solve.sh b/tasks/agg-p22-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4d26dd115a6a51baac7771614ce9c24be1394fe4 --- /dev/null +++ b/tasks/agg-p22-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89]' > "$answer" diff --git a/tasks/agg-p22-n12-s09/task.toml b/tasks/agg-p22-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..236287b7eba53ae926aef5860818357685485ee2 --- /dev/null +++ b/tasks/agg-p22-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n12-s09/tests/expected.json b/tasks/agg-p22-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0208a542906d77a899cc45439dbfe53936f90634 --- /dev/null +++ b/tasks/agg-p22-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89] diff --git a/tasks/agg-p22-n12-s09/tests/test.sh b/tasks/agg-p22-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n12-s10/instruction.md b/tasks/agg-p22-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f7bc3051e09aa70b286064fc6302e7e968c525e --- /dev/null +++ b/tasks/agg-p22-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n12-s10/solution/solve.sh b/tasks/agg-p22-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4d26dd115a6a51baac7771614ce9c24be1394fe4 --- /dev/null +++ b/tasks/agg-p22-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89]' > "$answer" diff --git a/tasks/agg-p22-n12-s10/task.toml b/tasks/agg-p22-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..966b9c4c6a6749af73183362aa0dfd2f5a51019e --- /dev/null +++ b/tasks/agg-p22-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n12-s10/tests/expected.json b/tasks/agg-p22-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0208a542906d77a899cc45439dbfe53936f90634 --- /dev/null +++ b/tasks/agg-p22-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89] diff --git a/tasks/agg-p22-n12-s10/tests/test.sh b/tasks/agg-p22-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n12-s11/instruction.md b/tasks/agg-p22-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fecaa35f4770297f29a146761d64774bbee9ff8f --- /dev/null +++ b/tasks/agg-p22-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ten. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n12-s11/solution/solve.sh b/tasks/agg-p22-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4d26dd115a6a51baac7771614ce9c24be1394fe4 --- /dev/null +++ b/tasks/agg-p22-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89]' > "$answer" diff --git a/tasks/agg-p22-n12-s11/task.toml b/tasks/agg-p22-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..074afba0350bfeed610e4962572ac6308b61888b --- /dev/null +++ b/tasks/agg-p22-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n12-s11/tests/expected.json b/tasks/agg-p22-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0208a542906d77a899cc45439dbfe53936f90634 --- /dev/null +++ b/tasks/agg-p22-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89] diff --git a/tasks/agg-p22-n12-s11/tests/test.sh b/tasks/agg-p22-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n12-s12/instruction.md b/tasks/agg-p22-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7201ad16b41f6e2d149e2c45df4bcd774a258af1 --- /dev/null +++ b/tasks/agg-p22-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n12-s12/solution/solve.sh b/tasks/agg-p22-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..4d26dd115a6a51baac7771614ce9c24be1394fe4 --- /dev/null +++ b/tasks/agg-p22-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89]' > "$answer" diff --git a/tasks/agg-p22-n12-s12/task.toml b/tasks/agg-p22-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..69d4a96c628d939de858bf0c43c4fd54d707936a --- /dev/null +++ b/tasks/agg-p22-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p22-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 22 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p22-n12-s12/tests/expected.json b/tasks/agg-p22-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0208a542906d77a899cc45439dbfe53936f90634 --- /dev/null +++ b/tasks/agg-p22-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[4, 5, 8, 10, 15, 23, 27, 31, 41, 71, 74, 89] diff --git a/tasks/agg-p22-n12-s12/tests/test.sh b/tasks/agg-p22-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p22-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p22-n16-s01/instruction.md b/tasks/agg-p22-n16-s01/instruction.md index 9137a4ab46a628c60be0b75972f0a9947e2c3883..4c327201eb92082d75247de85279b2149f069a49 100644 --- a/tasks/agg-p22-n16-s01/instruction.md +++ b/tasks/agg-p22-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s01/tests/test.sh b/tasks/agg-p22-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s01/tests/test.sh +++ b/tasks/agg-p22-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s02/instruction.md b/tasks/agg-p22-n16-s02/instruction.md index 356ad9a55f491febf5d0b5a7f08b59d72a30b581..eeb8d1d20be418011c3de786ceee7d8938bcc672 100644 --- a/tasks/agg-p22-n16-s02/instruction.md +++ b/tasks/agg-p22-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s02/tests/test.sh b/tasks/agg-p22-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s02/tests/test.sh +++ b/tasks/agg-p22-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s03/instruction.md b/tasks/agg-p22-n16-s03/instruction.md index 33c6e5250952f3077456a896c57a642ebd1c8d39..2ed4d1a65ed8a6a1ef17afdd17d82926d08e7770 100644 --- a/tasks/agg-p22-n16-s03/instruction.md +++ b/tasks/agg-p22-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s03/tests/test.sh b/tasks/agg-p22-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s03/tests/test.sh +++ b/tasks/agg-p22-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s04/instruction.md b/tasks/agg-p22-n16-s04/instruction.md index 722dd06eb5b0a1781e34a4a84c87448b77da2a59..5e39eb31f3bfe02211382c86f30186b5bbd8d4ba 100644 --- a/tasks/agg-p22-n16-s04/instruction.md +++ b/tasks/agg-p22-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s04/tests/test.sh b/tasks/agg-p22-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s04/tests/test.sh +++ b/tasks/agg-p22-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s05/instruction.md b/tasks/agg-p22-n16-s05/instruction.md index 17dddcebb1a38d642707c9e410dad0c89d830fb7..b2dbec3d0f3048cf387c99c193a35cad3f00783a 100644 --- a/tasks/agg-p22-n16-s05/instruction.md +++ b/tasks/agg-p22-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s05/tests/test.sh b/tasks/agg-p22-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s05/tests/test.sh +++ b/tasks/agg-p22-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s06/instruction.md b/tasks/agg-p22-n16-s06/instruction.md index 07133633c82ade16a43a26c7ec6cacc19d41b3bd..01eccecf7626f9336ce7f443b7b16b6f87314d4c 100644 --- a/tasks/agg-p22-n16-s06/instruction.md +++ b/tasks/agg-p22-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s06/tests/test.sh b/tasks/agg-p22-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s06/tests/test.sh +++ b/tasks/agg-p22-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s07/instruction.md b/tasks/agg-p22-n16-s07/instruction.md index d43b73fdfa99ecf2128fbcfe0de8040bb73fcb09..b12e192c283828cd14f2785cf454be268f90f5d0 100644 --- a/tasks/agg-p22-n16-s07/instruction.md +++ b/tasks/agg-p22-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s07/tests/test.sh b/tasks/agg-p22-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s07/tests/test.sh +++ b/tasks/agg-p22-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s08/instruction.md b/tasks/agg-p22-n16-s08/instruction.md index 7cf63660731cfb255f4030930d1fa31a717d902f..6dab277b2fabfee8f34045a8f6fb47ac3384734d 100644 --- a/tasks/agg-p22-n16-s08/instruction.md +++ b/tasks/agg-p22-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s08/tests/test.sh b/tasks/agg-p22-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s08/tests/test.sh +++ b/tasks/agg-p22-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s09/instruction.md b/tasks/agg-p22-n16-s09/instruction.md index 1245386f0aba38aec1627364e9a0bdce0b3a3214..7a6abd7e671d0d5e514cf3a081a12822f3e1fa80 100644 --- a/tasks/agg-p22-n16-s09/instruction.md +++ b/tasks/agg-p22-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s09/tests/test.sh b/tasks/agg-p22-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s09/tests/test.sh +++ b/tasks/agg-p22-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s10/instruction.md b/tasks/agg-p22-n16-s10/instruction.md index bb8416d585abe15f78ad9eaf98f78cbb202e2f9a..d2b26950540de67dd00f1a8d6c3d9b9c9c52ddf0 100644 --- a/tasks/agg-p22-n16-s10/instruction.md +++ b/tasks/agg-p22-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s10/tests/test.sh b/tasks/agg-p22-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s10/tests/test.sh +++ b/tasks/agg-p22-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s11/instruction.md b/tasks/agg-p22-n16-s11/instruction.md index 15dcbc6a01201bc29446da73c6532fccce6c79d2..ed78cbe54ff7c90674c657e53e6c6135b38c5fb4 100644 --- a/tasks/agg-p22-n16-s11/instruction.md +++ b/tasks/agg-p22-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s11/tests/test.sh b/tasks/agg-p22-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s11/tests/test.sh +++ b/tasks/agg-p22-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s12/instruction.md b/tasks/agg-p22-n16-s12/instruction.md index 99a7f97eb2774bf91fcf02fc9e18c71f2c746d9d..b0c86232070beace6f6b66df51114731c8869870 100644 --- a/tasks/agg-p22-n16-s12/instruction.md +++ b/tasks/agg-p22-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s12/tests/test.sh b/tasks/agg-p22-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s12/tests/test.sh +++ b/tasks/agg-p22-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s13/instruction.md b/tasks/agg-p22-n16-s13/instruction.md index ac5d07700d94f2ac8dcfe94fa7b7a0669218f24c..b6fbdfaa15c801714d533bc10b7c3a21161186fb 100644 --- a/tasks/agg-p22-n16-s13/instruction.md +++ b/tasks/agg-p22-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s13/tests/test.sh b/tasks/agg-p22-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s13/tests/test.sh +++ b/tasks/agg-p22-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s14/instruction.md b/tasks/agg-p22-n16-s14/instruction.md index f197f79da6e4638891b46f2053909c167ec13c32..856f7627093ea9ba708f7c4461f757925253fef9 100644 --- a/tasks/agg-p22-n16-s14/instruction.md +++ b/tasks/agg-p22-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s14/tests/test.sh b/tasks/agg-p22-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s14/tests/test.sh +++ b/tasks/agg-p22-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s15/instruction.md b/tasks/agg-p22-n16-s15/instruction.md index 1fc02ff38c01961e6ef2d04b50e560edacdcca90..1d5113c5dd5abf3bbd4601fe16ab16e11d5a8b7c 100644 --- a/tasks/agg-p22-n16-s15/instruction.md +++ b/tasks/agg-p22-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s15/tests/test.sh b/tasks/agg-p22-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s15/tests/test.sh +++ b/tasks/agg-p22-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p22-n16-s16/instruction.md b/tasks/agg-p22-n16-s16/instruction.md index 3a10e21a080f18532e8e18935bc65496e13588a2..3b81386b59fb88e5b2c11fc6768f76e2b16d0fe9 100644 --- a/tasks/agg-p22-n16-s16/instruction.md +++ b/tasks/agg-p22-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p22-n16-s16/tests/test.sh b/tasks/agg-p22-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p22-n16-s16/tests/test.sh +++ b/tasks/agg-p22-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n01-s01/instruction.md b/tasks/agg-p23-n01-s01/instruction.md index 41840c642bc983f3cbf2f4761e194e96c0777a45..8286a39c9d06a301041e2e4471cacfa9cfe8d30c 100644 --- a/tasks/agg-p23-n01-s01/instruction.md +++ b/tasks/agg-p23-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is twenty. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p23-n01-s01/tests/test.sh b/tasks/agg-p23-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n01-s01/tests/test.sh +++ b/tasks/agg-p23-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n02-s01/instruction.md b/tasks/agg-p23-n02-s01/instruction.md index 01155853905e7076e6da8ca45112bae47f6ac2c2..0f25cb677f3f0e49eefbafef2eb73b449ee6308b 100644 --- a/tasks/agg-p23-n02-s01/instruction.md +++ b/tasks/agg-p23-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n02-s01/tests/test.sh b/tasks/agg-p23-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n02-s01/tests/test.sh +++ b/tasks/agg-p23-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n02-s02/instruction.md b/tasks/agg-p23-n02-s02/instruction.md index c8fe5b794a826219ab972453490a4eb90154d01f..c308811016f34d497d56d134f4bb2872a06b3bc6 100644 --- a/tasks/agg-p23-n02-s02/instruction.md +++ b/tasks/agg-p23-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n02-s02/tests/test.sh b/tasks/agg-p23-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n02-s02/tests/test.sh +++ b/tasks/agg-p23-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n04-s01/instruction.md b/tasks/agg-p23-n04-s01/instruction.md index 862177065dd1207d2cfdca97cd16d4c00c321796..e2872ca13a9bdaac009d4ea9f256c26db9299563 100644 --- a/tasks/agg-p23-n04-s01/instruction.md +++ b/tasks/agg-p23-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n04-s01/tests/test.sh b/tasks/agg-p23-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n04-s01/tests/test.sh +++ b/tasks/agg-p23-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n04-s02/instruction.md b/tasks/agg-p23-n04-s02/instruction.md index 8024176648825a47cbe8613c954735752817a951..10e568c0f500ae92de8aeab1cb7393eb9ad3b69f 100644 --- a/tasks/agg-p23-n04-s02/instruction.md +++ b/tasks/agg-p23-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n04-s02/tests/test.sh b/tasks/agg-p23-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n04-s02/tests/test.sh +++ b/tasks/agg-p23-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n04-s03/instruction.md b/tasks/agg-p23-n04-s03/instruction.md index 57844953b25edf19db718990c35fe23e43f95f7a..1db807b3251e3960507b5ac241bf4434dd57e761 100644 --- a/tasks/agg-p23-n04-s03/instruction.md +++ b/tasks/agg-p23-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n04-s03/tests/test.sh b/tasks/agg-p23-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n04-s03/tests/test.sh +++ b/tasks/agg-p23-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n04-s04/instruction.md b/tasks/agg-p23-n04-s04/instruction.md index c9fc0cd60b16983bf7800f77c47afe49f90d719e..f63538db98b9db6cae350d60c2bb516975c71c99 100644 --- a/tasks/agg-p23-n04-s04/instruction.md +++ b/tasks/agg-p23-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n04-s04/tests/test.sh b/tasks/agg-p23-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n04-s04/tests/test.sh +++ b/tasks/agg-p23-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n06-s01/instruction.md b/tasks/agg-p23-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ca32ee2be3fc2697faddd2a4c3d7eb5a3243d9ec --- /dev/null +++ b/tasks/agg-p23-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n06-s01/solution/solve.sh b/tasks/agg-p23-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..baac997ef359ce8c782d4d9e19121e2dfc451679 --- /dev/null +++ b/tasks/agg-p23-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 20, 45, 55, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n06-s01/task.toml b/tasks/agg-p23-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c03ba72d67f70df767c05d81a870fffdff68976a --- /dev/null +++ b/tasks/agg-p23-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n06-s01/tests/expected.json b/tasks/agg-p23-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f43b9e0454df8c7ff7478d43e717482de90b9bcb --- /dev/null +++ b/tasks/agg-p23-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[1, 20, 45, 55, 81, 84] diff --git a/tasks/agg-p23-n06-s01/tests/test.sh b/tasks/agg-p23-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n06-s02/instruction.md b/tasks/agg-p23-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6cdb7b7da1ad956c023ce3608f04299c72876b04 --- /dev/null +++ b/tasks/agg-p23-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n06-s02/solution/solve.sh b/tasks/agg-p23-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..baac997ef359ce8c782d4d9e19121e2dfc451679 --- /dev/null +++ b/tasks/agg-p23-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 20, 45, 55, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n06-s02/task.toml b/tasks/agg-p23-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e38b955901192c712ceab589db67a2ca98408658 --- /dev/null +++ b/tasks/agg-p23-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n06-s02/tests/expected.json b/tasks/agg-p23-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f43b9e0454df8c7ff7478d43e717482de90b9bcb --- /dev/null +++ b/tasks/agg-p23-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[1, 20, 45, 55, 81, 84] diff --git a/tasks/agg-p23-n06-s02/tests/test.sh b/tasks/agg-p23-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n06-s03/instruction.md b/tasks/agg-p23-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fb49187f26e2368e600222d3d58320c4d2c80ff9 --- /dev/null +++ b/tasks/agg-p23-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n06-s03/solution/solve.sh b/tasks/agg-p23-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..baac997ef359ce8c782d4d9e19121e2dfc451679 --- /dev/null +++ b/tasks/agg-p23-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 20, 45, 55, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n06-s03/task.toml b/tasks/agg-p23-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c2c7fecdc5ce576e5601cbe6b25718be7a24c572 --- /dev/null +++ b/tasks/agg-p23-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n06-s03/tests/expected.json b/tasks/agg-p23-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f43b9e0454df8c7ff7478d43e717482de90b9bcb --- /dev/null +++ b/tasks/agg-p23-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[1, 20, 45, 55, 81, 84] diff --git a/tasks/agg-p23-n06-s03/tests/test.sh b/tasks/agg-p23-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n06-s04/instruction.md b/tasks/agg-p23-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..236469f55d1122b675e853c110cf18d69bc97270 --- /dev/null +++ b/tasks/agg-p23-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n06-s04/solution/solve.sh b/tasks/agg-p23-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..baac997ef359ce8c782d4d9e19121e2dfc451679 --- /dev/null +++ b/tasks/agg-p23-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 20, 45, 55, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n06-s04/task.toml b/tasks/agg-p23-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..389e58b5aa38695246256df057ec35a50566ec92 --- /dev/null +++ b/tasks/agg-p23-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n06-s04/tests/expected.json b/tasks/agg-p23-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f43b9e0454df8c7ff7478d43e717482de90b9bcb --- /dev/null +++ b/tasks/agg-p23-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[1, 20, 45, 55, 81, 84] diff --git a/tasks/agg-p23-n06-s04/tests/test.sh b/tasks/agg-p23-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n06-s05/instruction.md b/tasks/agg-p23-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..044902def78d0346c915e551662be15393efe3d7 --- /dev/null +++ b/tasks/agg-p23-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n06-s05/solution/solve.sh b/tasks/agg-p23-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..baac997ef359ce8c782d4d9e19121e2dfc451679 --- /dev/null +++ b/tasks/agg-p23-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 20, 45, 55, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n06-s05/task.toml b/tasks/agg-p23-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..89de31cf05485baa386f72ee8f57471c606ccf6c --- /dev/null +++ b/tasks/agg-p23-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n06-s05/tests/expected.json b/tasks/agg-p23-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f43b9e0454df8c7ff7478d43e717482de90b9bcb --- /dev/null +++ b/tasks/agg-p23-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[1, 20, 45, 55, 81, 84] diff --git a/tasks/agg-p23-n06-s05/tests/test.sh b/tasks/agg-p23-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n06-s06/instruction.md b/tasks/agg-p23-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e2baac9407f25a8a80dbe03ef2a2e62f6f6ad2c1 --- /dev/null +++ b/tasks/agg-p23-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n06-s06/solution/solve.sh b/tasks/agg-p23-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..baac997ef359ce8c782d4d9e19121e2dfc451679 --- /dev/null +++ b/tasks/agg-p23-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 20, 45, 55, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n06-s06/task.toml b/tasks/agg-p23-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1ee4c2b32dbf907c3e9f872e4993a6cb8a123564 --- /dev/null +++ b/tasks/agg-p23-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n06-s06/tests/expected.json b/tasks/agg-p23-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..f43b9e0454df8c7ff7478d43e717482de90b9bcb --- /dev/null +++ b/tasks/agg-p23-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[1, 20, 45, 55, 81, 84] diff --git a/tasks/agg-p23-n06-s06/tests/test.sh b/tasks/agg-p23-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n08-s01/instruction.md b/tasks/agg-p23-n08-s01/instruction.md index 45eef35ac00156eccf1849f3e7ce1978b9164536..e36fc7742cbb8f0fb0f25695cdfaa81e0348306d 100644 --- a/tasks/agg-p23-n08-s01/instruction.md +++ b/tasks/agg-p23-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n08-s01/tests/test.sh b/tasks/agg-p23-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n08-s01/tests/test.sh +++ b/tasks/agg-p23-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n08-s02/instruction.md b/tasks/agg-p23-n08-s02/instruction.md index 868a3b2d9b0dd94351f381b43ce54f12af196c62..a2da9735e6db7e6ac25c3beec2becb49fae9c011 100644 --- a/tasks/agg-p23-n08-s02/instruction.md +++ b/tasks/agg-p23-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n08-s02/tests/test.sh b/tasks/agg-p23-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n08-s02/tests/test.sh +++ b/tasks/agg-p23-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n08-s03/instruction.md b/tasks/agg-p23-n08-s03/instruction.md index a3ced584309e5034e6a9df4caf622b2a0502c9a5..1500ba63997389cf4258334a4bee45b1f9b4ce39 100644 --- a/tasks/agg-p23-n08-s03/instruction.md +++ b/tasks/agg-p23-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n08-s03/tests/test.sh b/tasks/agg-p23-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n08-s03/tests/test.sh +++ b/tasks/agg-p23-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n08-s04/instruction.md b/tasks/agg-p23-n08-s04/instruction.md index e45426f396d954e1affff91de56f66666add7d1c..9ac975d854c3ed506df0f5fe496fd94a52739e55 100644 --- a/tasks/agg-p23-n08-s04/instruction.md +++ b/tasks/agg-p23-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n08-s04/tests/test.sh b/tasks/agg-p23-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n08-s04/tests/test.sh +++ b/tasks/agg-p23-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n08-s05/instruction.md b/tasks/agg-p23-n08-s05/instruction.md index 6662e6911ad1105e195cbc6e76b3cc8d9854bef3..d4b85483dd2dae073bb973b1851f38367afa7271 100644 --- a/tasks/agg-p23-n08-s05/instruction.md +++ b/tasks/agg-p23-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n08-s05/tests/test.sh b/tasks/agg-p23-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n08-s05/tests/test.sh +++ b/tasks/agg-p23-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n08-s06/instruction.md b/tasks/agg-p23-n08-s06/instruction.md index 2af66d24dc696b132e6fd3eda0188f7a40c90b60..860958efbf695f34e33cd9d04c3d39b09cbfd196 100644 --- a/tasks/agg-p23-n08-s06/instruction.md +++ b/tasks/agg-p23-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n08-s06/tests/test.sh b/tasks/agg-p23-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n08-s06/tests/test.sh +++ b/tasks/agg-p23-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n08-s07/instruction.md b/tasks/agg-p23-n08-s07/instruction.md index aad332f1fb6e8e8c81b09b86bbbdb88e339f2b43..484d040f8eb4d2ae4796aeef5cfb0918ac7f0782 100644 --- a/tasks/agg-p23-n08-s07/instruction.md +++ b/tasks/agg-p23-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n08-s07/tests/test.sh b/tasks/agg-p23-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n08-s07/tests/test.sh +++ b/tasks/agg-p23-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n08-s08/instruction.md b/tasks/agg-p23-n08-s08/instruction.md index d356bb5ea0ea3378245500692d3d1b5cb41a9db4..5cb171c56a05b0aca43138d82992e7a971af7c0e 100644 --- a/tasks/agg-p23-n08-s08/instruction.md +++ b/tasks/agg-p23-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n08-s08/tests/test.sh b/tasks/agg-p23-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n08-s08/tests/test.sh +++ b/tasks/agg-p23-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n12-s01/instruction.md b/tasks/agg-p23-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cceebebec44b442f3530d40bdabf89079a1da1a4 --- /dev/null +++ b/tasks/agg-p23-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n12-s01/solution/solve.sh b/tasks/agg-p23-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1541aab5cc4bf124be5fb47274b25182854169b8 --- /dev/null +++ b/tasks/agg-p23-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n12-s01/task.toml b/tasks/agg-p23-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..be38a652b364fae9c01e9b069076a64c3c1527a3 --- /dev/null +++ b/tasks/agg-p23-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n12-s01/tests/expected.json b/tasks/agg-p23-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..55eb733e3799e23324186aab45ccbcbd73a13e76 --- /dev/null +++ b/tasks/agg-p23-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84] diff --git a/tasks/agg-p23-n12-s01/tests/test.sh b/tasks/agg-p23-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n12-s02/instruction.md b/tasks/agg-p23-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6fa059750b29d2d8c08b5edd7656a2921fb1a9ce --- /dev/null +++ b/tasks/agg-p23-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n12-s02/solution/solve.sh b/tasks/agg-p23-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1541aab5cc4bf124be5fb47274b25182854169b8 --- /dev/null +++ b/tasks/agg-p23-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n12-s02/task.toml b/tasks/agg-p23-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..837782bddd5f6300a7740d3e0bdf8d335ecc1c53 --- /dev/null +++ b/tasks/agg-p23-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n12-s02/tests/expected.json b/tasks/agg-p23-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..55eb733e3799e23324186aab45ccbcbd73a13e76 --- /dev/null +++ b/tasks/agg-p23-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84] diff --git a/tasks/agg-p23-n12-s02/tests/test.sh b/tasks/agg-p23-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n12-s03/instruction.md b/tasks/agg-p23-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..743bbc1fd4537e0975bd4083d0616f86374f4dee --- /dev/null +++ b/tasks/agg-p23-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n12-s03/solution/solve.sh b/tasks/agg-p23-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1541aab5cc4bf124be5fb47274b25182854169b8 --- /dev/null +++ b/tasks/agg-p23-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n12-s03/task.toml b/tasks/agg-p23-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a62a7ef58ff44346ea3eecb540db50b6ef07d1ef --- /dev/null +++ b/tasks/agg-p23-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n12-s03/tests/expected.json b/tasks/agg-p23-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..55eb733e3799e23324186aab45ccbcbd73a13e76 --- /dev/null +++ b/tasks/agg-p23-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84] diff --git a/tasks/agg-p23-n12-s03/tests/test.sh b/tasks/agg-p23-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n12-s04/instruction.md b/tasks/agg-p23-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..858fd908139109c01cfa1d8e481e4eba9092e0b5 --- /dev/null +++ b/tasks/agg-p23-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n12-s04/solution/solve.sh b/tasks/agg-p23-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1541aab5cc4bf124be5fb47274b25182854169b8 --- /dev/null +++ b/tasks/agg-p23-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n12-s04/task.toml b/tasks/agg-p23-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c97f5d18a75b7428528170de4bc7999223d501d3 --- /dev/null +++ b/tasks/agg-p23-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n12-s04/tests/expected.json b/tasks/agg-p23-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..55eb733e3799e23324186aab45ccbcbd73a13e76 --- /dev/null +++ b/tasks/agg-p23-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84] diff --git a/tasks/agg-p23-n12-s04/tests/test.sh b/tasks/agg-p23-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n12-s05/instruction.md b/tasks/agg-p23-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..50b917cf08b6446450c1a43541739f4d5c2745bd --- /dev/null +++ b/tasks/agg-p23-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n12-s05/solution/solve.sh b/tasks/agg-p23-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1541aab5cc4bf124be5fb47274b25182854169b8 --- /dev/null +++ b/tasks/agg-p23-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n12-s05/task.toml b/tasks/agg-p23-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..194d804d6e4800fd4695773f3ead18895db176fd --- /dev/null +++ b/tasks/agg-p23-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n12-s05/tests/expected.json b/tasks/agg-p23-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..55eb733e3799e23324186aab45ccbcbd73a13e76 --- /dev/null +++ b/tasks/agg-p23-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84] diff --git a/tasks/agg-p23-n12-s05/tests/test.sh b/tasks/agg-p23-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n12-s06/instruction.md b/tasks/agg-p23-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..83c5f678c22dac3906bb709f049b6407e3c59614 --- /dev/null +++ b/tasks/agg-p23-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n12-s06/solution/solve.sh b/tasks/agg-p23-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1541aab5cc4bf124be5fb47274b25182854169b8 --- /dev/null +++ b/tasks/agg-p23-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n12-s06/task.toml b/tasks/agg-p23-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..25d4c02e1b54061a468f814730bc7b1eb388abe1 --- /dev/null +++ b/tasks/agg-p23-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n12-s06/tests/expected.json b/tasks/agg-p23-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..55eb733e3799e23324186aab45ccbcbd73a13e76 --- /dev/null +++ b/tasks/agg-p23-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84] diff --git a/tasks/agg-p23-n12-s06/tests/test.sh b/tasks/agg-p23-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n12-s07/instruction.md b/tasks/agg-p23-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1108fd5c3dfb974655fad089e4918849532b6756 --- /dev/null +++ b/tasks/agg-p23-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n12-s07/solution/solve.sh b/tasks/agg-p23-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1541aab5cc4bf124be5fb47274b25182854169b8 --- /dev/null +++ b/tasks/agg-p23-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n12-s07/task.toml b/tasks/agg-p23-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..998934c682054f8d06fdbf52e36a9fbc18657e10 --- /dev/null +++ b/tasks/agg-p23-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n12-s07/tests/expected.json b/tasks/agg-p23-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..55eb733e3799e23324186aab45ccbcbd73a13e76 --- /dev/null +++ b/tasks/agg-p23-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84] diff --git a/tasks/agg-p23-n12-s07/tests/test.sh b/tasks/agg-p23-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n12-s08/instruction.md b/tasks/agg-p23-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d78566c7957cbe8132af56f4888ef6e81649dcb3 --- /dev/null +++ b/tasks/agg-p23-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n12-s08/solution/solve.sh b/tasks/agg-p23-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1541aab5cc4bf124be5fb47274b25182854169b8 --- /dev/null +++ b/tasks/agg-p23-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n12-s08/task.toml b/tasks/agg-p23-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0c2db7371c80bc4886b20f341dea0b453114066f --- /dev/null +++ b/tasks/agg-p23-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n12-s08/tests/expected.json b/tasks/agg-p23-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..55eb733e3799e23324186aab45ccbcbd73a13e76 --- /dev/null +++ b/tasks/agg-p23-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84] diff --git a/tasks/agg-p23-n12-s08/tests/test.sh b/tasks/agg-p23-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n12-s09/instruction.md b/tasks/agg-p23-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a6f6c527d4c1aacdad41d32eff67af8f36c275ba --- /dev/null +++ b/tasks/agg-p23-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n12-s09/solution/solve.sh b/tasks/agg-p23-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1541aab5cc4bf124be5fb47274b25182854169b8 --- /dev/null +++ b/tasks/agg-p23-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n12-s09/task.toml b/tasks/agg-p23-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..dee685be8e984d54273dac936c47056596016309 --- /dev/null +++ b/tasks/agg-p23-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n12-s09/tests/expected.json b/tasks/agg-p23-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..55eb733e3799e23324186aab45ccbcbd73a13e76 --- /dev/null +++ b/tasks/agg-p23-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84] diff --git a/tasks/agg-p23-n12-s09/tests/test.sh b/tasks/agg-p23-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n12-s10/instruction.md b/tasks/agg-p23-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2d59f1157c1824f7f2e06071771dcd5b3a427585 --- /dev/null +++ b/tasks/agg-p23-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n12-s10/solution/solve.sh b/tasks/agg-p23-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1541aab5cc4bf124be5fb47274b25182854169b8 --- /dev/null +++ b/tasks/agg-p23-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n12-s10/task.toml b/tasks/agg-p23-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..974392584167712c8d4dddc95b8a3cb3d12cdd9f --- /dev/null +++ b/tasks/agg-p23-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n12-s10/tests/expected.json b/tasks/agg-p23-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..55eb733e3799e23324186aab45ccbcbd73a13e76 --- /dev/null +++ b/tasks/agg-p23-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84] diff --git a/tasks/agg-p23-n12-s10/tests/test.sh b/tasks/agg-p23-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n12-s11/instruction.md b/tasks/agg-p23-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..183d4ee3e6b3a3123db0d338a5b1b7ad65451408 --- /dev/null +++ b/tasks/agg-p23-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n12-s11/solution/solve.sh b/tasks/agg-p23-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1541aab5cc4bf124be5fb47274b25182854169b8 --- /dev/null +++ b/tasks/agg-p23-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n12-s11/task.toml b/tasks/agg-p23-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e913de70ac9d39a1e08d16c7a868499219779ebf --- /dev/null +++ b/tasks/agg-p23-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n12-s11/tests/expected.json b/tasks/agg-p23-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..55eb733e3799e23324186aab45ccbcbd73a13e76 --- /dev/null +++ b/tasks/agg-p23-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84] diff --git a/tasks/agg-p23-n12-s11/tests/test.sh b/tasks/agg-p23-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n12-s12/instruction.md b/tasks/agg-p23-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8be11b5883f82241c1bfcc5354eaf615e8c586fb --- /dev/null +++ b/tasks/agg-p23-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n12-s12/solution/solve.sh b/tasks/agg-p23-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1541aab5cc4bf124be5fb47274b25182854169b8 --- /dev/null +++ b/tasks/agg-p23-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84]' > "$answer" diff --git a/tasks/agg-p23-n12-s12/task.toml b/tasks/agg-p23-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..34d74ff92bf3b3bb16da50d5b2d508a91369ba8c --- /dev/null +++ b/tasks/agg-p23-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p23-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 23 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p23-n12-s12/tests/expected.json b/tasks/agg-p23-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..55eb733e3799e23324186aab45ccbcbd73a13e76 --- /dev/null +++ b/tasks/agg-p23-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[1, 7, 16, 20, 30, 45, 51, 55, 69, 79, 81, 84] diff --git a/tasks/agg-p23-n12-s12/tests/test.sh b/tasks/agg-p23-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p23-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p23-n16-s01/instruction.md b/tasks/agg-p23-n16-s01/instruction.md index 81577d14ed82fb21b17e0bd51c9dc2a594f0c1b6..02d90432252450a09c7a989f19e252e75078b8f6 100644 --- a/tasks/agg-p23-n16-s01/instruction.md +++ b/tasks/agg-p23-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s01/tests/test.sh b/tasks/agg-p23-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s01/tests/test.sh +++ b/tasks/agg-p23-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s02/instruction.md b/tasks/agg-p23-n16-s02/instruction.md index f686b37d9314f1cebdb92d8ccf24f99b41852805..41b87bc8be3d28d17cbe9b046722f83de0efc15c 100644 --- a/tasks/agg-p23-n16-s02/instruction.md +++ b/tasks/agg-p23-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s02/tests/test.sh b/tasks/agg-p23-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s02/tests/test.sh +++ b/tasks/agg-p23-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s03/instruction.md b/tasks/agg-p23-n16-s03/instruction.md index 03acbc08880291cf4dacc5df318650e9c8d0e519..d9247c4c1b3fb63a80aa5e8b875de2a3f5be1b29 100644 --- a/tasks/agg-p23-n16-s03/instruction.md +++ b/tasks/agg-p23-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s03/tests/test.sh b/tasks/agg-p23-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s03/tests/test.sh +++ b/tasks/agg-p23-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s04/instruction.md b/tasks/agg-p23-n16-s04/instruction.md index 1a86ea7323aad3c91f00b65904f038f7e58f852d..d90a1687d9e29b3017d6bfd726c776fc6eece866 100644 --- a/tasks/agg-p23-n16-s04/instruction.md +++ b/tasks/agg-p23-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s04/tests/test.sh b/tasks/agg-p23-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s04/tests/test.sh +++ b/tasks/agg-p23-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s05/instruction.md b/tasks/agg-p23-n16-s05/instruction.md index 7d5ca093d11da3b866f85566039dbc2ac3bc8c84..7fe87dfffe4ad85e98cdbb07e05a77bf8a912afc 100644 --- a/tasks/agg-p23-n16-s05/instruction.md +++ b/tasks/agg-p23-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s05/tests/test.sh b/tasks/agg-p23-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s05/tests/test.sh +++ b/tasks/agg-p23-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s06/instruction.md b/tasks/agg-p23-n16-s06/instruction.md index be22dd060dc917313859b782fc59371588c6eefe..1ae1c83f6310b28c94d56fb3f9788827f371c4c2 100644 --- a/tasks/agg-p23-n16-s06/instruction.md +++ b/tasks/agg-p23-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s06/tests/test.sh b/tasks/agg-p23-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s06/tests/test.sh +++ b/tasks/agg-p23-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s07/instruction.md b/tasks/agg-p23-n16-s07/instruction.md index 6b3716855407e49bd1a2d27bc51b41f58fa7bb68..25ebaaacc5fd550a5645a5bd0d6a6adf1dfebf49 100644 --- a/tasks/agg-p23-n16-s07/instruction.md +++ b/tasks/agg-p23-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s07/tests/test.sh b/tasks/agg-p23-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s07/tests/test.sh +++ b/tasks/agg-p23-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s08/instruction.md b/tasks/agg-p23-n16-s08/instruction.md index f9807e3dca090e22409202efda192d4a7b9f5ac5..f9190cd6f2d679efa59828aa0ffdff708c0d41ce 100644 --- a/tasks/agg-p23-n16-s08/instruction.md +++ b/tasks/agg-p23-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s08/tests/test.sh b/tasks/agg-p23-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s08/tests/test.sh +++ b/tasks/agg-p23-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s09/instruction.md b/tasks/agg-p23-n16-s09/instruction.md index fb03ade0279ecf776a2ba0e785bd133ee36ecac6..3a629248b9ad5c45b818dd2ecd91107928508549 100644 --- a/tasks/agg-p23-n16-s09/instruction.md +++ b/tasks/agg-p23-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s09/tests/test.sh b/tasks/agg-p23-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s09/tests/test.sh +++ b/tasks/agg-p23-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s10/instruction.md b/tasks/agg-p23-n16-s10/instruction.md index 5c5d544b57ab574592871eba4a9cf1c900af41ae..fcbafd4a7228b70ba628c7a82d64679c3d4fad1c 100644 --- a/tasks/agg-p23-n16-s10/instruction.md +++ b/tasks/agg-p23-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s10/tests/test.sh b/tasks/agg-p23-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s10/tests/test.sh +++ b/tasks/agg-p23-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s11/instruction.md b/tasks/agg-p23-n16-s11/instruction.md index 8e668cd99b85cf802939dffe8e766b769fcc702e..87e4a5f52a7382cfe533f0cb59ccf7425210c8fe 100644 --- a/tasks/agg-p23-n16-s11/instruction.md +++ b/tasks/agg-p23-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s11/tests/test.sh b/tasks/agg-p23-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s11/tests/test.sh +++ b/tasks/agg-p23-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s12/instruction.md b/tasks/agg-p23-n16-s12/instruction.md index 7db3d283effcee2e29406da16a63a785bcffa3f6..bd72b4cb3ef80fa76d635dbc7ca834354ab9abf2 100644 --- a/tasks/agg-p23-n16-s12/instruction.md +++ b/tasks/agg-p23-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s12/tests/test.sh b/tasks/agg-p23-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s12/tests/test.sh +++ b/tasks/agg-p23-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s13/instruction.md b/tasks/agg-p23-n16-s13/instruction.md index 6d104365f5a2f721f3137e68a5cce07413cc5159..851ed8ff280ad3585c357918d2ff37530bb65f69 100644 --- a/tasks/agg-p23-n16-s13/instruction.md +++ b/tasks/agg-p23-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s13/tests/test.sh b/tasks/agg-p23-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s13/tests/test.sh +++ b/tasks/agg-p23-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s14/instruction.md b/tasks/agg-p23-n16-s14/instruction.md index 635dd02b39036aac45824980be06065d4cdbba80..df537d63f89b272009aff77b78050806566e850d 100644 --- a/tasks/agg-p23-n16-s14/instruction.md +++ b/tasks/agg-p23-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s14/tests/test.sh b/tasks/agg-p23-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s14/tests/test.sh +++ b/tasks/agg-p23-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s15/instruction.md b/tasks/agg-p23-n16-s15/instruction.md index 9e673d50df3d0049f8ebbc5f08e69f16f929b38f..f17a373aff362de5ccbc3d2752a0dc99bf30605b 100644 --- a/tasks/agg-p23-n16-s15/instruction.md +++ b/tasks/agg-p23-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s15/tests/test.sh b/tasks/agg-p23-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s15/tests/test.sh +++ b/tasks/agg-p23-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p23-n16-s16/instruction.md b/tasks/agg-p23-n16-s16/instruction.md index 1fe2576f1a20a278b177c066abc20e44af6a4729..5a9e9eac10d0ea0b9cedb5eefc9f2ace5395d6a9 100644 --- a/tasks/agg-p23-n16-s16/instruction.md +++ b/tasks/agg-p23-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p23-n16-s16/tests/test.sh b/tasks/agg-p23-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p23-n16-s16/tests/test.sh +++ b/tasks/agg-p23-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n01-s01/instruction.md b/tasks/agg-p24-n01-s01/instruction.md index a3466c7f82ee166ff08e35d24b2a461a2794a0ac..69303a0e1e65497ffa33b87b70d2dc8440bf2e0c 100644 --- a/tasks/agg-p24-n01-s01/instruction.md +++ b/tasks/agg-p24-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is ninety-five. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p24-n01-s01/tests/test.sh b/tasks/agg-p24-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n01-s01/tests/test.sh +++ b/tasks/agg-p24-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n02-s01/instruction.md b/tasks/agg-p24-n02-s01/instruction.md index 404111282daae97f1b44550984d4f55774e612a6..bbc8e07c8f27ee1e0caf837723afbbaa9b948395 100644 --- a/tasks/agg-p24-n02-s01/instruction.md +++ b/tasks/agg-p24-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n02-s01/tests/test.sh b/tasks/agg-p24-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n02-s01/tests/test.sh +++ b/tasks/agg-p24-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n02-s02/instruction.md b/tasks/agg-p24-n02-s02/instruction.md index d2d38bb45fd483fe5586be4932d257c85cdedb18..9f52fd0b38be53c858f9917b3d3f492ec4eaecd3 100644 --- a/tasks/agg-p24-n02-s02/instruction.md +++ b/tasks/agg-p24-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n02-s02/tests/test.sh b/tasks/agg-p24-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n02-s02/tests/test.sh +++ b/tasks/agg-p24-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n04-s01/instruction.md b/tasks/agg-p24-n04-s01/instruction.md index a0bd19ac3b592052aada59c15e572699cc95d555..9f271e6e5bd2b76802e443ccc54abcbd82366944 100644 --- a/tasks/agg-p24-n04-s01/instruction.md +++ b/tasks/agg-p24-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n04-s01/tests/test.sh b/tasks/agg-p24-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n04-s01/tests/test.sh +++ b/tasks/agg-p24-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n04-s02/instruction.md b/tasks/agg-p24-n04-s02/instruction.md index 680b87be1a6a736859b11707e6c2ffe2157f5d4c..53cd2d9001f1713a4d940bef539b9685cb756750 100644 --- a/tasks/agg-p24-n04-s02/instruction.md +++ b/tasks/agg-p24-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n04-s02/tests/test.sh b/tasks/agg-p24-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n04-s02/tests/test.sh +++ b/tasks/agg-p24-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n04-s03/instruction.md b/tasks/agg-p24-n04-s03/instruction.md index 00f783bdbb5bc769d650beb27a56e90f047df0cf..982344aa946f9e9135f86cdd8c758339f20e57da 100644 --- a/tasks/agg-p24-n04-s03/instruction.md +++ b/tasks/agg-p24-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n04-s03/tests/test.sh b/tasks/agg-p24-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n04-s03/tests/test.sh +++ b/tasks/agg-p24-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n04-s04/instruction.md b/tasks/agg-p24-n04-s04/instruction.md index 5dff7097a6f8187c56c213364fcbce4a861f1521..c010843ab5fc134ebc81d67ce8426ba4abf12f89 100644 --- a/tasks/agg-p24-n04-s04/instruction.md +++ b/tasks/agg-p24-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n04-s04/tests/test.sh b/tasks/agg-p24-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n04-s04/tests/test.sh +++ b/tasks/agg-p24-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n06-s01/instruction.md b/tasks/agg-p24-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6edae5a0cf2c4c0ea01e4142c514ceefe0b054da --- /dev/null +++ b/tasks/agg-p24-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n06-s01/solution/solve.sh b/tasks/agg-p24-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d0b2405e18e1f1f7d32320c85e1c912d08125e16 --- /dev/null +++ b/tasks/agg-p24-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 38, 50, 82, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n06-s01/task.toml b/tasks/agg-p24-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..98df880260d9d8fa3cd5185ada67c2047d554b97 --- /dev/null +++ b/tasks/agg-p24-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n06-s01/tests/expected.json b/tasks/agg-p24-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..38bf15407449751c10e139a6dbefd66f66195991 --- /dev/null +++ b/tasks/agg-p24-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[5, 38, 50, 82, 95, 95] diff --git a/tasks/agg-p24-n06-s01/tests/test.sh b/tasks/agg-p24-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n06-s02/instruction.md b/tasks/agg-p24-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d8bab66eb3d5058caae65c9939daace434a1e497 --- /dev/null +++ b/tasks/agg-p24-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n06-s02/solution/solve.sh b/tasks/agg-p24-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d0b2405e18e1f1f7d32320c85e1c912d08125e16 --- /dev/null +++ b/tasks/agg-p24-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 38, 50, 82, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n06-s02/task.toml b/tasks/agg-p24-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8c92246ca4086c65aedebeaba588d5b4402e70ab --- /dev/null +++ b/tasks/agg-p24-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n06-s02/tests/expected.json b/tasks/agg-p24-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..38bf15407449751c10e139a6dbefd66f66195991 --- /dev/null +++ b/tasks/agg-p24-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[5, 38, 50, 82, 95, 95] diff --git a/tasks/agg-p24-n06-s02/tests/test.sh b/tasks/agg-p24-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n06-s03/instruction.md b/tasks/agg-p24-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..16ce88e278c54743f1986a3fcb6cf261130fd7ec --- /dev/null +++ b/tasks/agg-p24-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n06-s03/solution/solve.sh b/tasks/agg-p24-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d0b2405e18e1f1f7d32320c85e1c912d08125e16 --- /dev/null +++ b/tasks/agg-p24-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 38, 50, 82, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n06-s03/task.toml b/tasks/agg-p24-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..408c9df90c7cd4ba64eee5fc7049fd1dbcff5eaf --- /dev/null +++ b/tasks/agg-p24-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n06-s03/tests/expected.json b/tasks/agg-p24-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..38bf15407449751c10e139a6dbefd66f66195991 --- /dev/null +++ b/tasks/agg-p24-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[5, 38, 50, 82, 95, 95] diff --git a/tasks/agg-p24-n06-s03/tests/test.sh b/tasks/agg-p24-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n06-s04/instruction.md b/tasks/agg-p24-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..547edc0316123f3842221dfa56518d93203667f2 --- /dev/null +++ b/tasks/agg-p24-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n06-s04/solution/solve.sh b/tasks/agg-p24-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d0b2405e18e1f1f7d32320c85e1c912d08125e16 --- /dev/null +++ b/tasks/agg-p24-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 38, 50, 82, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n06-s04/task.toml b/tasks/agg-p24-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6ecb8be99ac8c8c6f58ad2494db1ed1d79f4916e --- /dev/null +++ b/tasks/agg-p24-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n06-s04/tests/expected.json b/tasks/agg-p24-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..38bf15407449751c10e139a6dbefd66f66195991 --- /dev/null +++ b/tasks/agg-p24-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[5, 38, 50, 82, 95, 95] diff --git a/tasks/agg-p24-n06-s04/tests/test.sh b/tasks/agg-p24-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n06-s05/instruction.md b/tasks/agg-p24-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6edae5a0cf2c4c0ea01e4142c514ceefe0b054da --- /dev/null +++ b/tasks/agg-p24-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n06-s05/solution/solve.sh b/tasks/agg-p24-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d0b2405e18e1f1f7d32320c85e1c912d08125e16 --- /dev/null +++ b/tasks/agg-p24-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 38, 50, 82, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n06-s05/task.toml b/tasks/agg-p24-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2603b3d3ece17579dbe6751264019790e6b48603 --- /dev/null +++ b/tasks/agg-p24-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n06-s05/tests/expected.json b/tasks/agg-p24-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..38bf15407449751c10e139a6dbefd66f66195991 --- /dev/null +++ b/tasks/agg-p24-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[5, 38, 50, 82, 95, 95] diff --git a/tasks/agg-p24-n06-s05/tests/test.sh b/tasks/agg-p24-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n06-s06/instruction.md b/tasks/agg-p24-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a0391fdc0975cceaca695a17de8d8a49acb4f08d --- /dev/null +++ b/tasks/agg-p24-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n06-s06/solution/solve.sh b/tasks/agg-p24-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d0b2405e18e1f1f7d32320c85e1c912d08125e16 --- /dev/null +++ b/tasks/agg-p24-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 38, 50, 82, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n06-s06/task.toml b/tasks/agg-p24-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..598bd26beabffbb259fddcb4660b84f2d1e71700 --- /dev/null +++ b/tasks/agg-p24-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n06-s06/tests/expected.json b/tasks/agg-p24-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..38bf15407449751c10e139a6dbefd66f66195991 --- /dev/null +++ b/tasks/agg-p24-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[5, 38, 50, 82, 95, 95] diff --git a/tasks/agg-p24-n06-s06/tests/test.sh b/tasks/agg-p24-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n08-s01/instruction.md b/tasks/agg-p24-n08-s01/instruction.md index a042cb763ccdabe4fefaa1c5911478c0a369e6d0..404dd56dd7f109b5fe4e8b8fdcf1e15a36a23e04 100644 --- a/tasks/agg-p24-n08-s01/instruction.md +++ b/tasks/agg-p24-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n08-s01/tests/test.sh b/tasks/agg-p24-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n08-s01/tests/test.sh +++ b/tasks/agg-p24-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n08-s02/instruction.md b/tasks/agg-p24-n08-s02/instruction.md index e0a9ed87cd13d7f7ad66688fc91321b44512af39..39881fad07dce830eccfa9e268db7f0e1c5ba5bc 100644 --- a/tasks/agg-p24-n08-s02/instruction.md +++ b/tasks/agg-p24-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n08-s02/tests/test.sh b/tasks/agg-p24-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n08-s02/tests/test.sh +++ b/tasks/agg-p24-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n08-s03/instruction.md b/tasks/agg-p24-n08-s03/instruction.md index 75a1841e2fc9e7879f1e791caf8e81f6f6010a03..12ba1f30aac4454bd67f28a075ba69aa537ce1a2 100644 --- a/tasks/agg-p24-n08-s03/instruction.md +++ b/tasks/agg-p24-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n08-s03/tests/test.sh b/tasks/agg-p24-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n08-s03/tests/test.sh +++ b/tasks/agg-p24-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n08-s04/instruction.md b/tasks/agg-p24-n08-s04/instruction.md index 3e2cf199d0c7560bff5db95d105fc3d398218b9b..1851aafed962daf32119d5a471e50c234bb89b71 100644 --- a/tasks/agg-p24-n08-s04/instruction.md +++ b/tasks/agg-p24-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n08-s04/tests/test.sh b/tasks/agg-p24-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n08-s04/tests/test.sh +++ b/tasks/agg-p24-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n08-s05/instruction.md b/tasks/agg-p24-n08-s05/instruction.md index a042cb763ccdabe4fefaa1c5911478c0a369e6d0..404dd56dd7f109b5fe4e8b8fdcf1e15a36a23e04 100644 --- a/tasks/agg-p24-n08-s05/instruction.md +++ b/tasks/agg-p24-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n08-s05/tests/test.sh b/tasks/agg-p24-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n08-s05/tests/test.sh +++ b/tasks/agg-p24-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n08-s06/instruction.md b/tasks/agg-p24-n08-s06/instruction.md index e21142b6e0df055b0e0bb6899f7eab5e6cc92fb4..afc952163a35fd3b6411c5d3e8199ea1d02f0544 100644 --- a/tasks/agg-p24-n08-s06/instruction.md +++ b/tasks/agg-p24-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n08-s06/tests/test.sh b/tasks/agg-p24-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n08-s06/tests/test.sh +++ b/tasks/agg-p24-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n08-s07/instruction.md b/tasks/agg-p24-n08-s07/instruction.md index 33c7a00b4080f6f53fe6a6a1b5309b10579c3bc5..10415d93cfa0d6d1cfe2741b569ed7f93bc629a9 100644 --- a/tasks/agg-p24-n08-s07/instruction.md +++ b/tasks/agg-p24-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n08-s07/tests/test.sh b/tasks/agg-p24-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n08-s07/tests/test.sh +++ b/tasks/agg-p24-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n08-s08/instruction.md b/tasks/agg-p24-n08-s08/instruction.md index 3ef2ec7b4ffc263c27c3bece987fc632ef3cc457..bb55200f8e9216811174b4f1ef5eacfa2a976d3e 100644 --- a/tasks/agg-p24-n08-s08/instruction.md +++ b/tasks/agg-p24-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n08-s08/tests/test.sh b/tasks/agg-p24-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n08-s08/tests/test.sh +++ b/tasks/agg-p24-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n12-s01/instruction.md b/tasks/agg-p24-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f5aa8b70f2f447fb84dd6b26d80c8d7537bebefb --- /dev/null +++ b/tasks/agg-p24-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n12-s01/solution/solve.sh b/tasks/agg-p24-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..219323db9c2dd42dcb839b0f75c03a764505b2fa --- /dev/null +++ b/tasks/agg-p24-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n12-s01/task.toml b/tasks/agg-p24-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d1ce76b67683181805816330e7478e09949474d4 --- /dev/null +++ b/tasks/agg-p24-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n12-s01/tests/expected.json b/tasks/agg-p24-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3ea6a28f4ddf7daa17361ace57ec3395c7caa71f --- /dev/null +++ b/tasks/agg-p24-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95] diff --git a/tasks/agg-p24-n12-s01/tests/test.sh b/tasks/agg-p24-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n12-s02/instruction.md b/tasks/agg-p24-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cf78bc234ac7165a12e4210d637bece975cb648e --- /dev/null +++ b/tasks/agg-p24-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n12-s02/solution/solve.sh b/tasks/agg-p24-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..219323db9c2dd42dcb839b0f75c03a764505b2fa --- /dev/null +++ b/tasks/agg-p24-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n12-s02/task.toml b/tasks/agg-p24-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..96f47fb5f735040aa116c4e63f1b68a9eef806f1 --- /dev/null +++ b/tasks/agg-p24-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n12-s02/tests/expected.json b/tasks/agg-p24-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3ea6a28f4ddf7daa17361ace57ec3395c7caa71f --- /dev/null +++ b/tasks/agg-p24-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95] diff --git a/tasks/agg-p24-n12-s02/tests/test.sh b/tasks/agg-p24-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n12-s03/instruction.md b/tasks/agg-p24-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9b0eae8063e1419234bd5a4b5a1fded790f6da23 --- /dev/null +++ b/tasks/agg-p24-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n12-s03/solution/solve.sh b/tasks/agg-p24-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..219323db9c2dd42dcb839b0f75c03a764505b2fa --- /dev/null +++ b/tasks/agg-p24-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n12-s03/task.toml b/tasks/agg-p24-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3ce1f9254ebbf2cef6c88d18f8f16e469a1d4bc6 --- /dev/null +++ b/tasks/agg-p24-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n12-s03/tests/expected.json b/tasks/agg-p24-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3ea6a28f4ddf7daa17361ace57ec3395c7caa71f --- /dev/null +++ b/tasks/agg-p24-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95] diff --git a/tasks/agg-p24-n12-s03/tests/test.sh b/tasks/agg-p24-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n12-s04/instruction.md b/tasks/agg-p24-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..15ed18a1ca8a56a1480af89c847dcd1fab959a55 --- /dev/null +++ b/tasks/agg-p24-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n12-s04/solution/solve.sh b/tasks/agg-p24-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..219323db9c2dd42dcb839b0f75c03a764505b2fa --- /dev/null +++ b/tasks/agg-p24-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n12-s04/task.toml b/tasks/agg-p24-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9b7823f5a163ea513bf08d70bde646e846e82a66 --- /dev/null +++ b/tasks/agg-p24-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n12-s04/tests/expected.json b/tasks/agg-p24-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3ea6a28f4ddf7daa17361ace57ec3395c7caa71f --- /dev/null +++ b/tasks/agg-p24-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95] diff --git a/tasks/agg-p24-n12-s04/tests/test.sh b/tasks/agg-p24-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n12-s05/instruction.md b/tasks/agg-p24-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f5aa8b70f2f447fb84dd6b26d80c8d7537bebefb --- /dev/null +++ b/tasks/agg-p24-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n12-s05/solution/solve.sh b/tasks/agg-p24-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..219323db9c2dd42dcb839b0f75c03a764505b2fa --- /dev/null +++ b/tasks/agg-p24-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n12-s05/task.toml b/tasks/agg-p24-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c9228a9b29cb35fe6794f21d1983a4e096f89e06 --- /dev/null +++ b/tasks/agg-p24-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n12-s05/tests/expected.json b/tasks/agg-p24-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3ea6a28f4ddf7daa17361ace57ec3395c7caa71f --- /dev/null +++ b/tasks/agg-p24-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95] diff --git a/tasks/agg-p24-n12-s05/tests/test.sh b/tasks/agg-p24-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n12-s06/instruction.md b/tasks/agg-p24-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bb40c13254db093b772375b0bb70c64bc0b6f8b8 --- /dev/null +++ b/tasks/agg-p24-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n12-s06/solution/solve.sh b/tasks/agg-p24-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..219323db9c2dd42dcb839b0f75c03a764505b2fa --- /dev/null +++ b/tasks/agg-p24-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n12-s06/task.toml b/tasks/agg-p24-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8b0bbb7ffa7d8ec1d16e8e2486671184ee539a4f --- /dev/null +++ b/tasks/agg-p24-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n12-s06/tests/expected.json b/tasks/agg-p24-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3ea6a28f4ddf7daa17361ace57ec3395c7caa71f --- /dev/null +++ b/tasks/agg-p24-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95] diff --git a/tasks/agg-p24-n12-s06/tests/test.sh b/tasks/agg-p24-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n12-s07/instruction.md b/tasks/agg-p24-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..031c703efd3d4ee9d7e52a3211272bdd8fdb3bc4 --- /dev/null +++ b/tasks/agg-p24-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n12-s07/solution/solve.sh b/tasks/agg-p24-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..219323db9c2dd42dcb839b0f75c03a764505b2fa --- /dev/null +++ b/tasks/agg-p24-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n12-s07/task.toml b/tasks/agg-p24-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d7f8f84b7d98fb4f497412cefd20a1f8f6b382b9 --- /dev/null +++ b/tasks/agg-p24-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n12-s07/tests/expected.json b/tasks/agg-p24-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3ea6a28f4ddf7daa17361ace57ec3395c7caa71f --- /dev/null +++ b/tasks/agg-p24-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95] diff --git a/tasks/agg-p24-n12-s07/tests/test.sh b/tasks/agg-p24-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n12-s08/instruction.md b/tasks/agg-p24-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0409dcf29dd269b54d93ca84f2b9a827d9cf7d50 --- /dev/null +++ b/tasks/agg-p24-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n12-s08/solution/solve.sh b/tasks/agg-p24-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..219323db9c2dd42dcb839b0f75c03a764505b2fa --- /dev/null +++ b/tasks/agg-p24-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n12-s08/task.toml b/tasks/agg-p24-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..14c38f887ad5c9697a8fbe453cac9b745b6c9504 --- /dev/null +++ b/tasks/agg-p24-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n12-s08/tests/expected.json b/tasks/agg-p24-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3ea6a28f4ddf7daa17361ace57ec3395c7caa71f --- /dev/null +++ b/tasks/agg-p24-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95] diff --git a/tasks/agg-p24-n12-s08/tests/test.sh b/tasks/agg-p24-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n12-s09/instruction.md b/tasks/agg-p24-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e2d2cc8e9bcc9cde703e8c6628f5b3a2b4377585 --- /dev/null +++ b/tasks/agg-p24-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n12-s09/solution/solve.sh b/tasks/agg-p24-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..219323db9c2dd42dcb839b0f75c03a764505b2fa --- /dev/null +++ b/tasks/agg-p24-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n12-s09/task.toml b/tasks/agg-p24-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cfa4da9f3882ba609d4aaa4df3aedf9368a43bc7 --- /dev/null +++ b/tasks/agg-p24-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n12-s09/tests/expected.json b/tasks/agg-p24-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3ea6a28f4ddf7daa17361ace57ec3395c7caa71f --- /dev/null +++ b/tasks/agg-p24-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95] diff --git a/tasks/agg-p24-n12-s09/tests/test.sh b/tasks/agg-p24-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n12-s10/instruction.md b/tasks/agg-p24-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f8a7f84dc10e74d2d1efa1c93d0465b237cf01e --- /dev/null +++ b/tasks/agg-p24-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n12-s10/solution/solve.sh b/tasks/agg-p24-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..219323db9c2dd42dcb839b0f75c03a764505b2fa --- /dev/null +++ b/tasks/agg-p24-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n12-s10/task.toml b/tasks/agg-p24-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..af4553fe65e3c45ff24690e3dee436e4f8f38ce6 --- /dev/null +++ b/tasks/agg-p24-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n12-s10/tests/expected.json b/tasks/agg-p24-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3ea6a28f4ddf7daa17361ace57ec3395c7caa71f --- /dev/null +++ b/tasks/agg-p24-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95] diff --git a/tasks/agg-p24-n12-s10/tests/test.sh b/tasks/agg-p24-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n12-s11/instruction.md b/tasks/agg-p24-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ac0fb3589d74cb9ec090d7919df303360b87a4cd --- /dev/null +++ b/tasks/agg-p24-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n12-s11/solution/solve.sh b/tasks/agg-p24-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..219323db9c2dd42dcb839b0f75c03a764505b2fa --- /dev/null +++ b/tasks/agg-p24-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n12-s11/task.toml b/tasks/agg-p24-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..54c36918266d46c8c5bf810bb59d160054ccffbc --- /dev/null +++ b/tasks/agg-p24-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n12-s11/tests/expected.json b/tasks/agg-p24-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3ea6a28f4ddf7daa17361ace57ec3395c7caa71f --- /dev/null +++ b/tasks/agg-p24-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95] diff --git a/tasks/agg-p24-n12-s11/tests/test.sh b/tasks/agg-p24-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n12-s12/instruction.md b/tasks/agg-p24-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fecaa35f4770297f29a146761d64774bbee9ff8f --- /dev/null +++ b/tasks/agg-p24-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ten. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n12-s12/solution/solve.sh b/tasks/agg-p24-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..219323db9c2dd42dcb839b0f75c03a764505b2fa --- /dev/null +++ b/tasks/agg-p24-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95]' > "$answer" diff --git a/tasks/agg-p24-n12-s12/task.toml b/tasks/agg-p24-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..670863ecf3b63b0494b68796604e34b3644e6089 --- /dev/null +++ b/tasks/agg-p24-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p24-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 24 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p24-n12-s12/tests/expected.json b/tasks/agg-p24-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3ea6a28f4ddf7daa17361ace57ec3395c7caa71f --- /dev/null +++ b/tasks/agg-p24-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[5, 10, 37, 38, 39, 50, 67, 82, 87, 89, 95, 95] diff --git a/tasks/agg-p24-n12-s12/tests/test.sh b/tasks/agg-p24-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p24-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p24-n16-s01/instruction.md b/tasks/agg-p24-n16-s01/instruction.md index 961985392d4b99bbc35d52871fb6450061a34bb5..c98bd62598f64ffcd1b51c3b31ced8e3cda7460c 100644 --- a/tasks/agg-p24-n16-s01/instruction.md +++ b/tasks/agg-p24-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s01/tests/test.sh b/tasks/agg-p24-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s01/tests/test.sh +++ b/tasks/agg-p24-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s02/instruction.md b/tasks/agg-p24-n16-s02/instruction.md index 8719f945164b6c7adba0eec9b9728be32d6bfe5e..10a630b21435ec8e620ae5e83c5dc41b678c1031 100644 --- a/tasks/agg-p24-n16-s02/instruction.md +++ b/tasks/agg-p24-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s02/tests/test.sh b/tasks/agg-p24-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s02/tests/test.sh +++ b/tasks/agg-p24-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s03/instruction.md b/tasks/agg-p24-n16-s03/instruction.md index 17dddcebb1a38d642707c9e410dad0c89d830fb7..b2dbec3d0f3048cf387c99c193a35cad3f00783a 100644 --- a/tasks/agg-p24-n16-s03/instruction.md +++ b/tasks/agg-p24-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s03/tests/test.sh b/tasks/agg-p24-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s03/tests/test.sh +++ b/tasks/agg-p24-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s04/instruction.md b/tasks/agg-p24-n16-s04/instruction.md index 24cae7506709ba17884a6f8faefcffb0fa372426..9945eb9052cf9160c89519b7d1952d5ce19dacf8 100644 --- a/tasks/agg-p24-n16-s04/instruction.md +++ b/tasks/agg-p24-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s04/tests/test.sh b/tasks/agg-p24-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s04/tests/test.sh +++ b/tasks/agg-p24-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s05/instruction.md b/tasks/agg-p24-n16-s05/instruction.md index 961985392d4b99bbc35d52871fb6450061a34bb5..c98bd62598f64ffcd1b51c3b31ced8e3cda7460c 100644 --- a/tasks/agg-p24-n16-s05/instruction.md +++ b/tasks/agg-p24-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s05/tests/test.sh b/tasks/agg-p24-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s05/tests/test.sh +++ b/tasks/agg-p24-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s06/instruction.md b/tasks/agg-p24-n16-s06/instruction.md index d398ea97722601a49a457530f502678c0a1433cf..e1c1f7d3b01724d8dea774465c5f5d8397b1d161 100644 --- a/tasks/agg-p24-n16-s06/instruction.md +++ b/tasks/agg-p24-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s06/tests/test.sh b/tasks/agg-p24-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s06/tests/test.sh +++ b/tasks/agg-p24-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s07/instruction.md b/tasks/agg-p24-n16-s07/instruction.md index 3c1a8c1b0c33b8354227b277a5b1885c3067b4d2..6a9948c4088c17e7b78a078e0010c060500c2e8e 100644 --- a/tasks/agg-p24-n16-s07/instruction.md +++ b/tasks/agg-p24-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s07/tests/test.sh b/tasks/agg-p24-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s07/tests/test.sh +++ b/tasks/agg-p24-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s08/instruction.md b/tasks/agg-p24-n16-s08/instruction.md index 33c6e5250952f3077456a896c57a642ebd1c8d39..2ed4d1a65ed8a6a1ef17afdd17d82926d08e7770 100644 --- a/tasks/agg-p24-n16-s08/instruction.md +++ b/tasks/agg-p24-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s08/tests/test.sh b/tasks/agg-p24-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s08/tests/test.sh +++ b/tasks/agg-p24-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s09/instruction.md b/tasks/agg-p24-n16-s09/instruction.md index d443699990b373083b3fdeb1d846a400fde6e65b..b08879079fe0758b0792198b043d2a59e2a911e2 100644 --- a/tasks/agg-p24-n16-s09/instruction.md +++ b/tasks/agg-p24-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s09/tests/test.sh b/tasks/agg-p24-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s09/tests/test.sh +++ b/tasks/agg-p24-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s10/instruction.md b/tasks/agg-p24-n16-s10/instruction.md index 10bcc3d169e35738b1fb80abb7316f9cd7c1b230..254a759d5a0113deb55448c366676577f275a1f1 100644 --- a/tasks/agg-p24-n16-s10/instruction.md +++ b/tasks/agg-p24-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s10/tests/test.sh b/tasks/agg-p24-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s10/tests/test.sh +++ b/tasks/agg-p24-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s11/instruction.md b/tasks/agg-p24-n16-s11/instruction.md index cebfaeb748131e1409dea8040dd71bd8744f230b..f855e374529122b9a74995c685bdc0845b660076 100644 --- a/tasks/agg-p24-n16-s11/instruction.md +++ b/tasks/agg-p24-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s11/tests/test.sh b/tasks/agg-p24-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s11/tests/test.sh +++ b/tasks/agg-p24-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s12/instruction.md b/tasks/agg-p24-n16-s12/instruction.md index 15dcbc6a01201bc29446da73c6532fccce6c79d2..ed78cbe54ff7c90674c657e53e6c6135b38c5fb4 100644 --- a/tasks/agg-p24-n16-s12/instruction.md +++ b/tasks/agg-p24-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s12/tests/test.sh b/tasks/agg-p24-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s12/tests/test.sh +++ b/tasks/agg-p24-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s13/instruction.md b/tasks/agg-p24-n16-s13/instruction.md index 3c1a8c1b0c33b8354227b277a5b1885c3067b4d2..6a9948c4088c17e7b78a078e0010c060500c2e8e 100644 --- a/tasks/agg-p24-n16-s13/instruction.md +++ b/tasks/agg-p24-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s13/tests/test.sh b/tasks/agg-p24-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s13/tests/test.sh +++ b/tasks/agg-p24-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s14/instruction.md b/tasks/agg-p24-n16-s14/instruction.md index ff35f53eda015951f8078ff0751a783f65818958..e3de5217dbfb10d0002092b53e5f480dfe257ac6 100644 --- a/tasks/agg-p24-n16-s14/instruction.md +++ b/tasks/agg-p24-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s14/tests/test.sh b/tasks/agg-p24-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s14/tests/test.sh +++ b/tasks/agg-p24-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s15/instruction.md b/tasks/agg-p24-n16-s15/instruction.md index d443699990b373083b3fdeb1d846a400fde6e65b..b08879079fe0758b0792198b043d2a59e2a911e2 100644 --- a/tasks/agg-p24-n16-s15/instruction.md +++ b/tasks/agg-p24-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s15/tests/test.sh b/tasks/agg-p24-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s15/tests/test.sh +++ b/tasks/agg-p24-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p24-n16-s16/instruction.md b/tasks/agg-p24-n16-s16/instruction.md index ff35f53eda015951f8078ff0751a783f65818958..e3de5217dbfb10d0002092b53e5f480dfe257ac6 100644 --- a/tasks/agg-p24-n16-s16/instruction.md +++ b/tasks/agg-p24-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p24-n16-s16/tests/test.sh b/tasks/agg-p24-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p24-n16-s16/tests/test.sh +++ b/tasks/agg-p24-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n01-s01/instruction.md b/tasks/agg-p25-n01-s01/instruction.md index 94fb1eea0ee202266134436fc623908ddfc125c3..d3ec7a450ab9b95b96f9c3f319db54cc243be73f 100644 --- a/tasks/agg-p25-n01-s01/instruction.md +++ b/tasks/agg-p25-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is thirty-three. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p25-n01-s01/tests/test.sh b/tasks/agg-p25-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n01-s01/tests/test.sh +++ b/tasks/agg-p25-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n02-s01/instruction.md b/tasks/agg-p25-n02-s01/instruction.md index fabd26fc361f6b59ad3563506cc531694f46bf6a..6161d451925057d69d1de4e7235d6810901c9767 100644 --- a/tasks/agg-p25-n02-s01/instruction.md +++ b/tasks/agg-p25-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n02-s01/tests/test.sh b/tasks/agg-p25-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n02-s01/tests/test.sh +++ b/tasks/agg-p25-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n02-s02/instruction.md b/tasks/agg-p25-n02-s02/instruction.md index b74bfd8401dd040791909d6cf84388bf2c5d8158..bcb39746e03d029ee957c0404ca62fcdeeeeb54b 100644 --- a/tasks/agg-p25-n02-s02/instruction.md +++ b/tasks/agg-p25-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n02-s02/tests/test.sh b/tasks/agg-p25-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n02-s02/tests/test.sh +++ b/tasks/agg-p25-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n04-s01/instruction.md b/tasks/agg-p25-n04-s01/instruction.md index defb2567dbe8012ebceefb3afc2ea1f9ca889d8e..ebe6e8507834a1bb8243353af1201955554e3599 100644 --- a/tasks/agg-p25-n04-s01/instruction.md +++ b/tasks/agg-p25-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n04-s01/tests/test.sh b/tasks/agg-p25-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n04-s01/tests/test.sh +++ b/tasks/agg-p25-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n04-s02/instruction.md b/tasks/agg-p25-n04-s02/instruction.md index 9f0f47428da9534522c799558543c5d8ccdc8480..44b8bbe3ba28ccce8bc63a48a88c1f664b898955 100644 --- a/tasks/agg-p25-n04-s02/instruction.md +++ b/tasks/agg-p25-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n04-s02/tests/test.sh b/tasks/agg-p25-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n04-s02/tests/test.sh +++ b/tasks/agg-p25-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n04-s03/instruction.md b/tasks/agg-p25-n04-s03/instruction.md index 634df09d93ffa8b0d27ad435c23fa0756ccec488..6bfd9c04bcf1227beed07e89eb749d849e806b0e 100644 --- a/tasks/agg-p25-n04-s03/instruction.md +++ b/tasks/agg-p25-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n04-s03/tests/test.sh b/tasks/agg-p25-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n04-s03/tests/test.sh +++ b/tasks/agg-p25-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n04-s04/instruction.md b/tasks/agg-p25-n04-s04/instruction.md index 710f629ccf5142ea8ee0ed83d0f5e26f17b2a9f7..fda8fc5dde6070d9bbc81bec80fa565d092f5bb3 100644 --- a/tasks/agg-p25-n04-s04/instruction.md +++ b/tasks/agg-p25-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n04-s04/tests/test.sh b/tasks/agg-p25-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n04-s04/tests/test.sh +++ b/tasks/agg-p25-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n06-s01/instruction.md b/tasks/agg-p25-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b81a4d1b6c939af2f3d24f5e34fcceb0afa2bed5 --- /dev/null +++ b/tasks/agg-p25-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n06-s01/solution/solve.sh b/tasks/agg-p25-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..562272019e455e6fd65bcffb10aaf0e510fb7402 --- /dev/null +++ b/tasks/agg-p25-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n06-s01/task.toml b/tasks/agg-p25-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d0fa5e46977634b26ff4f63a3cc1f7a74f5a27a2 --- /dev/null +++ b/tasks/agg-p25-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n06-s01/tests/expected.json b/tasks/agg-p25-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..266c7c43f28735c66ecfbd3b41f1b5c72d4a5e19 --- /dev/null +++ b/tasks/agg-p25-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[18, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n06-s01/tests/test.sh b/tasks/agg-p25-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n06-s02/instruction.md b/tasks/agg-p25-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..786d1fe5ab83a56dbefe27ab387d283f9bb9cdfa --- /dev/null +++ b/tasks/agg-p25-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n06-s02/solution/solve.sh b/tasks/agg-p25-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..562272019e455e6fd65bcffb10aaf0e510fb7402 --- /dev/null +++ b/tasks/agg-p25-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n06-s02/task.toml b/tasks/agg-p25-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2d77ca964465d476fff5b850833bd67594d1c3c2 --- /dev/null +++ b/tasks/agg-p25-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n06-s02/tests/expected.json b/tasks/agg-p25-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..266c7c43f28735c66ecfbd3b41f1b5c72d4a5e19 --- /dev/null +++ b/tasks/agg-p25-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[18, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n06-s02/tests/test.sh b/tasks/agg-p25-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n06-s03/instruction.md b/tasks/agg-p25-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..04cf285aad86357cf317bf42bc4d056ca047a35f --- /dev/null +++ b/tasks/agg-p25-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighteen. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n06-s03/solution/solve.sh b/tasks/agg-p25-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..562272019e455e6fd65bcffb10aaf0e510fb7402 --- /dev/null +++ b/tasks/agg-p25-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n06-s03/task.toml b/tasks/agg-p25-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7c085a3a67e60c3d2352da60fd922ff3551735e2 --- /dev/null +++ b/tasks/agg-p25-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n06-s03/tests/expected.json b/tasks/agg-p25-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..266c7c43f28735c66ecfbd3b41f1b5c72d4a5e19 --- /dev/null +++ b/tasks/agg-p25-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[18, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n06-s03/tests/test.sh b/tasks/agg-p25-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n06-s04/instruction.md b/tasks/agg-p25-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0fe2a8811c726ac28727f6150ebaf8ef2a18e8b4 --- /dev/null +++ b/tasks/agg-p25-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n06-s04/solution/solve.sh b/tasks/agg-p25-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..562272019e455e6fd65bcffb10aaf0e510fb7402 --- /dev/null +++ b/tasks/agg-p25-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n06-s04/task.toml b/tasks/agg-p25-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c6c3e38775c099a421d9d4319f5167cfba39fd29 --- /dev/null +++ b/tasks/agg-p25-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n06-s04/tests/expected.json b/tasks/agg-p25-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..266c7c43f28735c66ecfbd3b41f1b5c72d4a5e19 --- /dev/null +++ b/tasks/agg-p25-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[18, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n06-s04/tests/test.sh b/tasks/agg-p25-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n06-s05/instruction.md b/tasks/agg-p25-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..326a00ec02152317b44607a0b27c1212b67c67ec --- /dev/null +++ b/tasks/agg-p25-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n06-s05/solution/solve.sh b/tasks/agg-p25-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..562272019e455e6fd65bcffb10aaf0e510fb7402 --- /dev/null +++ b/tasks/agg-p25-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n06-s05/task.toml b/tasks/agg-p25-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4bd6d51f58cd5f37d9f2ac90e1ee62365eb35584 --- /dev/null +++ b/tasks/agg-p25-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n06-s05/tests/expected.json b/tasks/agg-p25-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..266c7c43f28735c66ecfbd3b41f1b5c72d4a5e19 --- /dev/null +++ b/tasks/agg-p25-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[18, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n06-s05/tests/test.sh b/tasks/agg-p25-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n06-s06/instruction.md b/tasks/agg-p25-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..56024a42b25de88e503a849ea137440b919aee68 --- /dev/null +++ b/tasks/agg-p25-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n06-s06/solution/solve.sh b/tasks/agg-p25-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..562272019e455e6fd65bcffb10aaf0e510fb7402 --- /dev/null +++ b/tasks/agg-p25-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[18, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n06-s06/task.toml b/tasks/agg-p25-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9407633e6df9da0208def47f7503e7f3ae84682b --- /dev/null +++ b/tasks/agg-p25-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n06-s06/tests/expected.json b/tasks/agg-p25-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..266c7c43f28735c66ecfbd3b41f1b5c72d4a5e19 --- /dev/null +++ b/tasks/agg-p25-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[18, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n06-s06/tests/test.sh b/tasks/agg-p25-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n08-s01/instruction.md b/tasks/agg-p25-n08-s01/instruction.md index 03c94df8689da4f5b0401f4f3decef651eb9aee0..f59205650a10f9897e7be3c7465c8741b50c1c70 100644 --- a/tasks/agg-p25-n08-s01/instruction.md +++ b/tasks/agg-p25-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n08-s01/tests/test.sh b/tasks/agg-p25-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n08-s01/tests/test.sh +++ b/tasks/agg-p25-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n08-s02/instruction.md b/tasks/agg-p25-n08-s02/instruction.md index 8e1b9f225dd41eb13af45ff90735dba5c7d221b8..b9565161529d3e10879a2835bc30196ea1a66220 100644 --- a/tasks/agg-p25-n08-s02/instruction.md +++ b/tasks/agg-p25-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n08-s02/tests/test.sh b/tasks/agg-p25-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n08-s02/tests/test.sh +++ b/tasks/agg-p25-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n08-s03/instruction.md b/tasks/agg-p25-n08-s03/instruction.md index 6c99d3a421a7820e0d5105d7dbdbfe39b5c15b23..eac777563a00a423c4b9e27422d5202e95928f87 100644 --- a/tasks/agg-p25-n08-s03/instruction.md +++ b/tasks/agg-p25-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n08-s03/tests/test.sh b/tasks/agg-p25-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n08-s03/tests/test.sh +++ b/tasks/agg-p25-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n08-s04/instruction.md b/tasks/agg-p25-n08-s04/instruction.md index 8fc5da9fd3f2fb4b928fc1ff5a73236e0d218b54..d868b319945fa8116452ca00f04e2b9e846d67e5 100644 --- a/tasks/agg-p25-n08-s04/instruction.md +++ b/tasks/agg-p25-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n08-s04/tests/test.sh b/tasks/agg-p25-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n08-s04/tests/test.sh +++ b/tasks/agg-p25-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n08-s05/instruction.md b/tasks/agg-p25-n08-s05/instruction.md index cc6db9caeb675d9f6434dc4b0b3050a0227102ba..2ec4265b33403e29ca222c18421412dd54a02a07 100644 --- a/tasks/agg-p25-n08-s05/instruction.md +++ b/tasks/agg-p25-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n08-s05/tests/test.sh b/tasks/agg-p25-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n08-s05/tests/test.sh +++ b/tasks/agg-p25-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n08-s06/instruction.md b/tasks/agg-p25-n08-s06/instruction.md index ac3f976754721a0afc38f69e19af1e9379b5a5f2..2748249b79ef6166ba43aff9fdd05407d48af0e6 100644 --- a/tasks/agg-p25-n08-s06/instruction.md +++ b/tasks/agg-p25-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n08-s06/tests/test.sh b/tasks/agg-p25-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n08-s06/tests/test.sh +++ b/tasks/agg-p25-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n08-s07/instruction.md b/tasks/agg-p25-n08-s07/instruction.md index 629e2ae1c728c40605589960cbd96dae496187c1..90998e7368407ace103b85ca771303d040de423a 100644 --- a/tasks/agg-p25-n08-s07/instruction.md +++ b/tasks/agg-p25-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n08-s07/tests/test.sh b/tasks/agg-p25-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n08-s07/tests/test.sh +++ b/tasks/agg-p25-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n08-s08/instruction.md b/tasks/agg-p25-n08-s08/instruction.md index cf3f948e811657d947ed622b357f1d1ea8535635..11b308d9edcb7cc85390662efc67a129d6c33242 100644 --- a/tasks/agg-p25-n08-s08/instruction.md +++ b/tasks/agg-p25-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n08-s08/tests/test.sh b/tasks/agg-p25-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n08-s08/tests/test.sh +++ b/tasks/agg-p25-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n12-s01/instruction.md b/tasks/agg-p25-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ac4ab97ac5016f85469b1949304d6955bc5c5cdc --- /dev/null +++ b/tasks/agg-p25-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n12-s01/solution/solve.sh b/tasks/agg-p25-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb49b696d7a1fb6815325b2ff11a937ff186d1a3 --- /dev/null +++ b/tasks/agg-p25-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n12-s01/task.toml b/tasks/agg-p25-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..19bbd58e39a4cfdab77786a31fd76eec6f1a27e4 --- /dev/null +++ b/tasks/agg-p25-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n12-s01/tests/expected.json b/tasks/agg-p25-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..d4449ff12f53c02fcc7034f79de85ca955373f70 --- /dev/null +++ b/tasks/agg-p25-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n12-s01/tests/test.sh b/tasks/agg-p25-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n12-s02/instruction.md b/tasks/agg-p25-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b53986e9d0f1dda9020e6d798d3ea3ceceb7b772 --- /dev/null +++ b/tasks/agg-p25-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n12-s02/solution/solve.sh b/tasks/agg-p25-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb49b696d7a1fb6815325b2ff11a937ff186d1a3 --- /dev/null +++ b/tasks/agg-p25-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n12-s02/task.toml b/tasks/agg-p25-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..035d9635a349ac74173657af6f241bc23178f6df --- /dev/null +++ b/tasks/agg-p25-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n12-s02/tests/expected.json b/tasks/agg-p25-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..d4449ff12f53c02fcc7034f79de85ca955373f70 --- /dev/null +++ b/tasks/agg-p25-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n12-s02/tests/test.sh b/tasks/agg-p25-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n12-s03/instruction.md b/tasks/agg-p25-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bc6ecc07cf5acdcd085bd56b2102f26cc68f534e --- /dev/null +++ b/tasks/agg-p25-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n12-s03/solution/solve.sh b/tasks/agg-p25-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb49b696d7a1fb6815325b2ff11a937ff186d1a3 --- /dev/null +++ b/tasks/agg-p25-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n12-s03/task.toml b/tasks/agg-p25-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..88055f95ed6ffeb907f66218a1f53ecb492fc01b --- /dev/null +++ b/tasks/agg-p25-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n12-s03/tests/expected.json b/tasks/agg-p25-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..d4449ff12f53c02fcc7034f79de85ca955373f70 --- /dev/null +++ b/tasks/agg-p25-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n12-s03/tests/test.sh b/tasks/agg-p25-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n12-s04/instruction.md b/tasks/agg-p25-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ca689d19db465172c22b2b5dc9acaa4689858529 --- /dev/null +++ b/tasks/agg-p25-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n12-s04/solution/solve.sh b/tasks/agg-p25-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb49b696d7a1fb6815325b2ff11a937ff186d1a3 --- /dev/null +++ b/tasks/agg-p25-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n12-s04/task.toml b/tasks/agg-p25-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f301ddb9c1fdd607f05009a2bcac5a345e9241df --- /dev/null +++ b/tasks/agg-p25-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n12-s04/tests/expected.json b/tasks/agg-p25-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..d4449ff12f53c02fcc7034f79de85ca955373f70 --- /dev/null +++ b/tasks/agg-p25-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n12-s04/tests/test.sh b/tasks/agg-p25-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n12-s05/instruction.md b/tasks/agg-p25-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..41fb67f1fddf041cb3abba7edd30f2b84e14a8c5 --- /dev/null +++ b/tasks/agg-p25-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n12-s05/solution/solve.sh b/tasks/agg-p25-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb49b696d7a1fb6815325b2ff11a937ff186d1a3 --- /dev/null +++ b/tasks/agg-p25-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n12-s05/task.toml b/tasks/agg-p25-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7a7274b85be0c67480a72e9a64f108811f010508 --- /dev/null +++ b/tasks/agg-p25-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n12-s05/tests/expected.json b/tasks/agg-p25-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..d4449ff12f53c02fcc7034f79de85ca955373f70 --- /dev/null +++ b/tasks/agg-p25-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n12-s05/tests/test.sh b/tasks/agg-p25-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n12-s06/instruction.md b/tasks/agg-p25-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c6a91a1f79bd6d228b316441f459621de12405e1 --- /dev/null +++ b/tasks/agg-p25-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n12-s06/solution/solve.sh b/tasks/agg-p25-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb49b696d7a1fb6815325b2ff11a937ff186d1a3 --- /dev/null +++ b/tasks/agg-p25-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n12-s06/task.toml b/tasks/agg-p25-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1412a917bd08dc605d62f90ec139f061a4ce7343 --- /dev/null +++ b/tasks/agg-p25-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n12-s06/tests/expected.json b/tasks/agg-p25-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..d4449ff12f53c02fcc7034f79de85ca955373f70 --- /dev/null +++ b/tasks/agg-p25-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n12-s06/tests/test.sh b/tasks/agg-p25-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n12-s07/instruction.md b/tasks/agg-p25-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..afc44302e5446bbcbad60907a837f2fdde13fc15 --- /dev/null +++ b/tasks/agg-p25-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n12-s07/solution/solve.sh b/tasks/agg-p25-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb49b696d7a1fb6815325b2ff11a937ff186d1a3 --- /dev/null +++ b/tasks/agg-p25-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n12-s07/task.toml b/tasks/agg-p25-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b44e06e86402276d3aa21db55988c48b4a2e6432 --- /dev/null +++ b/tasks/agg-p25-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n12-s07/tests/expected.json b/tasks/agg-p25-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..d4449ff12f53c02fcc7034f79de85ca955373f70 --- /dev/null +++ b/tasks/agg-p25-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n12-s07/tests/test.sh b/tasks/agg-p25-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n12-s08/instruction.md b/tasks/agg-p25-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e9a64c0f27aa67e1cac11aadbbf81280d4edf727 --- /dev/null +++ b/tasks/agg-p25-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n12-s08/solution/solve.sh b/tasks/agg-p25-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb49b696d7a1fb6815325b2ff11a937ff186d1a3 --- /dev/null +++ b/tasks/agg-p25-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n12-s08/task.toml b/tasks/agg-p25-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1e2e4fd11098e91c5232b6ef869a0bf889b2cb71 --- /dev/null +++ b/tasks/agg-p25-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n12-s08/tests/expected.json b/tasks/agg-p25-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..d4449ff12f53c02fcc7034f79de85ca955373f70 --- /dev/null +++ b/tasks/agg-p25-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n12-s08/tests/test.sh b/tasks/agg-p25-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n12-s09/instruction.md b/tasks/agg-p25-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0b81ba6377af99eb65b5b6131fb2d1747a9214e3 --- /dev/null +++ b/tasks/agg-p25-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n12-s09/solution/solve.sh b/tasks/agg-p25-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb49b696d7a1fb6815325b2ff11a937ff186d1a3 --- /dev/null +++ b/tasks/agg-p25-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n12-s09/task.toml b/tasks/agg-p25-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7406d599d750f7b9079c0b3b302ffa843b671e33 --- /dev/null +++ b/tasks/agg-p25-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n12-s09/tests/expected.json b/tasks/agg-p25-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..d4449ff12f53c02fcc7034f79de85ca955373f70 --- /dev/null +++ b/tasks/agg-p25-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n12-s09/tests/test.sh b/tasks/agg-p25-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n12-s10/instruction.md b/tasks/agg-p25-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d20cc8cc1f1c9617a83e07868fc43399bd7b4a36 --- /dev/null +++ b/tasks/agg-p25-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is nineteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n12-s10/solution/solve.sh b/tasks/agg-p25-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb49b696d7a1fb6815325b2ff11a937ff186d1a3 --- /dev/null +++ b/tasks/agg-p25-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n12-s10/task.toml b/tasks/agg-p25-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..42e084f96e620d3c7ee7631543e0678e24724ea4 --- /dev/null +++ b/tasks/agg-p25-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n12-s10/tests/expected.json b/tasks/agg-p25-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..d4449ff12f53c02fcc7034f79de85ca955373f70 --- /dev/null +++ b/tasks/agg-p25-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n12-s10/tests/test.sh b/tasks/agg-p25-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n12-s11/instruction.md b/tasks/agg-p25-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e9a64c0f27aa67e1cac11aadbbf81280d4edf727 --- /dev/null +++ b/tasks/agg-p25-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n12-s11/solution/solve.sh b/tasks/agg-p25-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb49b696d7a1fb6815325b2ff11a937ff186d1a3 --- /dev/null +++ b/tasks/agg-p25-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n12-s11/task.toml b/tasks/agg-p25-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..954d4fac43f84b72da5732f59e6c32ad306d3948 --- /dev/null +++ b/tasks/agg-p25-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n12-s11/tests/expected.json b/tasks/agg-p25-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..d4449ff12f53c02fcc7034f79de85ca955373f70 --- /dev/null +++ b/tasks/agg-p25-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n12-s11/tests/test.sh b/tasks/agg-p25-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n12-s12/instruction.md b/tasks/agg-p25-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..afbeda4e94399ae98c38833dd1dd245acc819d21 --- /dev/null +++ b/tasks/agg-p25-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n12-s12/solution/solve.sh b/tasks/agg-p25-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..eb49b696d7a1fb6815325b2ff11a937ff186d1a3 --- /dev/null +++ b/tasks/agg-p25-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88]' > "$answer" diff --git a/tasks/agg-p25-n12-s12/task.toml b/tasks/agg-p25-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f0a89648699e075427d0d007d25f6ae80abb7a81 --- /dev/null +++ b/tasks/agg-p25-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p25-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 25 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p25-n12-s12/tests/expected.json b/tasks/agg-p25-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..d4449ff12f53c02fcc7034f79de85ca955373f70 --- /dev/null +++ b/tasks/agg-p25-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 6, 6, 18, 19, 21, 22, 33, 46, 73, 88] diff --git a/tasks/agg-p25-n12-s12/tests/test.sh b/tasks/agg-p25-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p25-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p25-n16-s01/instruction.md b/tasks/agg-p25-n16-s01/instruction.md index d92b3c67aa869a2b7ccb0b74ca78af94faae0b02..671a8ab2cae28823934c021dcf645fc4038d0570 100644 --- a/tasks/agg-p25-n16-s01/instruction.md +++ b/tasks/agg-p25-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s01/tests/test.sh b/tasks/agg-p25-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s01/tests/test.sh +++ b/tasks/agg-p25-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s02/instruction.md b/tasks/agg-p25-n16-s02/instruction.md index ac5d07700d94f2ac8dcfe94fa7b7a0669218f24c..b6fbdfaa15c801714d533bc10b7c3a21161186fb 100644 --- a/tasks/agg-p25-n16-s02/instruction.md +++ b/tasks/agg-p25-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s02/tests/test.sh b/tasks/agg-p25-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s02/tests/test.sh +++ b/tasks/agg-p25-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s03/instruction.md b/tasks/agg-p25-n16-s03/instruction.md index 57c62f85ec1ef4f9ca9aa899d016621c4b04432a..e1bd267ed9ac9c4fbf94870756f771be1265779a 100644 --- a/tasks/agg-p25-n16-s03/instruction.md +++ b/tasks/agg-p25-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s03/tests/test.sh b/tasks/agg-p25-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s03/tests/test.sh +++ b/tasks/agg-p25-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s04/instruction.md b/tasks/agg-p25-n16-s04/instruction.md index f197f79da6e4638891b46f2053909c167ec13c32..856f7627093ea9ba708f7c4461f757925253fef9 100644 --- a/tasks/agg-p25-n16-s04/instruction.md +++ b/tasks/agg-p25-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s04/tests/test.sh b/tasks/agg-p25-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s04/tests/test.sh +++ b/tasks/agg-p25-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s05/instruction.md b/tasks/agg-p25-n16-s05/instruction.md index b3b047922a06bc269fe7ce7c02e822b0dcc610c6..318c3c472459b432bb96b7ce0080943dec5e4004 100644 --- a/tasks/agg-p25-n16-s05/instruction.md +++ b/tasks/agg-p25-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s05/tests/test.sh b/tasks/agg-p25-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s05/tests/test.sh +++ b/tasks/agg-p25-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s06/instruction.md b/tasks/agg-p25-n16-s06/instruction.md index 57ed1435e76bbf3118473fa8b3b4d8bd26d42701..60d1a7b8eaf4ac4dcc56be0c2220caf87906fc98 100644 --- a/tasks/agg-p25-n16-s06/instruction.md +++ b/tasks/agg-p25-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s06/tests/test.sh b/tasks/agg-p25-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s06/tests/test.sh +++ b/tasks/agg-p25-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s07/instruction.md b/tasks/agg-p25-n16-s07/instruction.md index ebbf18dd1885eca56e4b99d9ba0f301603987c59..967cbe42235491e28138a2858f78709704a1bd82 100644 --- a/tasks/agg-p25-n16-s07/instruction.md +++ b/tasks/agg-p25-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s07/tests/test.sh b/tasks/agg-p25-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s07/tests/test.sh +++ b/tasks/agg-p25-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s08/instruction.md b/tasks/agg-p25-n16-s08/instruction.md index 783fbdc57d72bfcadc0344c5e85549aaa9f3efe7..2ea77ca8a72381d318a57abe0da7ab6c0330246a 100644 --- a/tasks/agg-p25-n16-s08/instruction.md +++ b/tasks/agg-p25-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s08/tests/test.sh b/tasks/agg-p25-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s08/tests/test.sh +++ b/tasks/agg-p25-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s09/instruction.md b/tasks/agg-p25-n16-s09/instruction.md index 1499aaac42fb5c39eb3846670f67c71d3d44d289..b294d334efb52a9a07adec52a680b842f6ba6953 100644 --- a/tasks/agg-p25-n16-s09/instruction.md +++ b/tasks/agg-p25-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s09/tests/test.sh b/tasks/agg-p25-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s09/tests/test.sh +++ b/tasks/agg-p25-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s10/instruction.md b/tasks/agg-p25-n16-s10/instruction.md index 689dc52da259912a8583e539c40d32957d6e1982..9e4a131dc1a41521b0b243cd7a381ee18c406e61 100644 --- a/tasks/agg-p25-n16-s10/instruction.md +++ b/tasks/agg-p25-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s10/tests/test.sh b/tasks/agg-p25-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s10/tests/test.sh +++ b/tasks/agg-p25-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s11/instruction.md b/tasks/agg-p25-n16-s11/instruction.md index 783fbdc57d72bfcadc0344c5e85549aaa9f3efe7..2ea77ca8a72381d318a57abe0da7ab6c0330246a 100644 --- a/tasks/agg-p25-n16-s11/instruction.md +++ b/tasks/agg-p25-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s11/tests/test.sh b/tasks/agg-p25-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s11/tests/test.sh +++ b/tasks/agg-p25-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s12/instruction.md b/tasks/agg-p25-n16-s12/instruction.md index 635dd02b39036aac45824980be06065d4cdbba80..df537d63f89b272009aff77b78050806566e850d 100644 --- a/tasks/agg-p25-n16-s12/instruction.md +++ b/tasks/agg-p25-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s12/tests/test.sh b/tasks/agg-p25-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s12/tests/test.sh +++ b/tasks/agg-p25-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s13/instruction.md b/tasks/agg-p25-n16-s13/instruction.md index 1499aaac42fb5c39eb3846670f67c71d3d44d289..b294d334efb52a9a07adec52a680b842f6ba6953 100644 --- a/tasks/agg-p25-n16-s13/instruction.md +++ b/tasks/agg-p25-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s13/tests/test.sh b/tasks/agg-p25-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s13/tests/test.sh +++ b/tasks/agg-p25-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s14/instruction.md b/tasks/agg-p25-n16-s14/instruction.md index 57ed1435e76bbf3118473fa8b3b4d8bd26d42701..60d1a7b8eaf4ac4dcc56be0c2220caf87906fc98 100644 --- a/tasks/agg-p25-n16-s14/instruction.md +++ b/tasks/agg-p25-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s14/tests/test.sh b/tasks/agg-p25-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s14/tests/test.sh +++ b/tasks/agg-p25-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s15/instruction.md b/tasks/agg-p25-n16-s15/instruction.md index 842ab62762da159702eecd05bee6231e50b04d8f..3585f20798dad91576432b94fc5446156ebc4cbd 100644 --- a/tasks/agg-p25-n16-s15/instruction.md +++ b/tasks/agg-p25-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s15/tests/test.sh b/tasks/agg-p25-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s15/tests/test.sh +++ b/tasks/agg-p25-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p25-n16-s16/instruction.md b/tasks/agg-p25-n16-s16/instruction.md index 1499aaac42fb5c39eb3846670f67c71d3d44d289..b294d334efb52a9a07adec52a680b842f6ba6953 100644 --- a/tasks/agg-p25-n16-s16/instruction.md +++ b/tasks/agg-p25-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p25-n16-s16/tests/test.sh b/tasks/agg-p25-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p25-n16-s16/tests/test.sh +++ b/tasks/agg-p25-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n01-s01/instruction.md b/tasks/agg-p26-n01-s01/instruction.md index be7de43e766e41adf7f3f09c987b8c3545e68d33..5b6a68c25b70d92b4d60818ca238626d69bb89b9 100644 --- a/tasks/agg-p26-n01-s01/instruction.md +++ b/tasks/agg-p26-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is twenty-one. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p26-n01-s01/tests/test.sh b/tasks/agg-p26-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n01-s01/tests/test.sh +++ b/tasks/agg-p26-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n02-s01/instruction.md b/tasks/agg-p26-n02-s01/instruction.md index 550cdc5c3a47e00d080a9942ae9e64c38ee8e974..8f35404971d0197b36a6c4721ed45744546c6fd7 100644 --- a/tasks/agg-p26-n02-s01/instruction.md +++ b/tasks/agg-p26-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n02-s01/tests/test.sh b/tasks/agg-p26-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n02-s01/tests/test.sh +++ b/tasks/agg-p26-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n02-s02/instruction.md b/tasks/agg-p26-n02-s02/instruction.md index 01155853905e7076e6da8ca45112bae47f6ac2c2..0f25cb677f3f0e49eefbafef2eb73b449ee6308b 100644 --- a/tasks/agg-p26-n02-s02/instruction.md +++ b/tasks/agg-p26-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n02-s02/tests/test.sh b/tasks/agg-p26-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n02-s02/tests/test.sh +++ b/tasks/agg-p26-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n04-s01/instruction.md b/tasks/agg-p26-n04-s01/instruction.md index 1d459a41a5bc548fc489adacacb5b98ea0b37b13..c23c64da948c6fe04dcc8bb31be9e986b6268c53 100644 --- a/tasks/agg-p26-n04-s01/instruction.md +++ b/tasks/agg-p26-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n04-s01/tests/test.sh b/tasks/agg-p26-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n04-s01/tests/test.sh +++ b/tasks/agg-p26-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n04-s02/instruction.md b/tasks/agg-p26-n04-s02/instruction.md index 862177065dd1207d2cfdca97cd16d4c00c321796..e2872ca13a9bdaac009d4ea9f256c26db9299563 100644 --- a/tasks/agg-p26-n04-s02/instruction.md +++ b/tasks/agg-p26-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n04-s02/tests/test.sh b/tasks/agg-p26-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n04-s02/tests/test.sh +++ b/tasks/agg-p26-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n04-s03/instruction.md b/tasks/agg-p26-n04-s03/instruction.md index 4e0ea7af0cbf9f514ae40b7ebdeb8125d1ab0241..f638f78ced32ce4c34ebe7b9c35c5e4caf8ae14f 100644 --- a/tasks/agg-p26-n04-s03/instruction.md +++ b/tasks/agg-p26-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n04-s03/tests/test.sh b/tasks/agg-p26-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n04-s03/tests/test.sh +++ b/tasks/agg-p26-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n04-s04/instruction.md b/tasks/agg-p26-n04-s04/instruction.md index c9fc0cd60b16983bf7800f77c47afe49f90d719e..f63538db98b9db6cae350d60c2bb516975c71c99 100644 --- a/tasks/agg-p26-n04-s04/instruction.md +++ b/tasks/agg-p26-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n04-s04/tests/test.sh b/tasks/agg-p26-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n04-s04/tests/test.sh +++ b/tasks/agg-p26-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n06-s01/instruction.md b/tasks/agg-p26-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b771c7eadb2a72d02d7a63723c5af1acd80eb156 --- /dev/null +++ b/tasks/agg-p26-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n06-s01/solution/solve.sh b/tasks/agg-p26-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7b6cfcb9229bb0ce9768604c6c033a5fad5c8da5 --- /dev/null +++ b/tasks/agg-p26-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 4, 12, 20, 21, 36]' > "$answer" diff --git a/tasks/agg-p26-n06-s01/task.toml b/tasks/agg-p26-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5f3c5f1549bcc9945dd3b085cdb5b50a5094a626 --- /dev/null +++ b/tasks/agg-p26-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n06-s01/tests/expected.json b/tasks/agg-p26-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0fde749c513429596321605fbb2f5b79808077a5 --- /dev/null +++ b/tasks/agg-p26-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[1, 4, 12, 20, 21, 36] diff --git a/tasks/agg-p26-n06-s01/tests/test.sh b/tasks/agg-p26-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n06-s02/instruction.md b/tasks/agg-p26-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ca32ee2be3fc2697faddd2a4c3d7eb5a3243d9ec --- /dev/null +++ b/tasks/agg-p26-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n06-s02/solution/solve.sh b/tasks/agg-p26-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7b6cfcb9229bb0ce9768604c6c033a5fad5c8da5 --- /dev/null +++ b/tasks/agg-p26-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 4, 12, 20, 21, 36]' > "$answer" diff --git a/tasks/agg-p26-n06-s02/task.toml b/tasks/agg-p26-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..87463d05e60c6fe066b257f61ed45be228754cc0 --- /dev/null +++ b/tasks/agg-p26-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n06-s02/tests/expected.json b/tasks/agg-p26-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0fde749c513429596321605fbb2f5b79808077a5 --- /dev/null +++ b/tasks/agg-p26-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[1, 4, 12, 20, 21, 36] diff --git a/tasks/agg-p26-n06-s02/tests/test.sh b/tasks/agg-p26-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n06-s03/instruction.md b/tasks/agg-p26-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..745b2ae16840e1bcb6509c8b0b1545c62eecc1f6 --- /dev/null +++ b/tasks/agg-p26-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n06-s03/solution/solve.sh b/tasks/agg-p26-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7b6cfcb9229bb0ce9768604c6c033a5fad5c8da5 --- /dev/null +++ b/tasks/agg-p26-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 4, 12, 20, 21, 36]' > "$answer" diff --git a/tasks/agg-p26-n06-s03/task.toml b/tasks/agg-p26-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b4d5f76998c608e2be166328c056530506f3985a --- /dev/null +++ b/tasks/agg-p26-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n06-s03/tests/expected.json b/tasks/agg-p26-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0fde749c513429596321605fbb2f5b79808077a5 --- /dev/null +++ b/tasks/agg-p26-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[1, 4, 12, 20, 21, 36] diff --git a/tasks/agg-p26-n06-s03/tests/test.sh b/tasks/agg-p26-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n06-s04/instruction.md b/tasks/agg-p26-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..236469f55d1122b675e853c110cf18d69bc97270 --- /dev/null +++ b/tasks/agg-p26-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n06-s04/solution/solve.sh b/tasks/agg-p26-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7b6cfcb9229bb0ce9768604c6c033a5fad5c8da5 --- /dev/null +++ b/tasks/agg-p26-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 4, 12, 20, 21, 36]' > "$answer" diff --git a/tasks/agg-p26-n06-s04/task.toml b/tasks/agg-p26-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e8903124cf798db083f71682f8b96b462da6aad4 --- /dev/null +++ b/tasks/agg-p26-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n06-s04/tests/expected.json b/tasks/agg-p26-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0fde749c513429596321605fbb2f5b79808077a5 --- /dev/null +++ b/tasks/agg-p26-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[1, 4, 12, 20, 21, 36] diff --git a/tasks/agg-p26-n06-s04/tests/test.sh b/tasks/agg-p26-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n06-s05/instruction.md b/tasks/agg-p26-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..646aa6fe77ffd0dcaac27a989fcd74a9b9cf343d --- /dev/null +++ b/tasks/agg-p26-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n06-s05/solution/solve.sh b/tasks/agg-p26-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7b6cfcb9229bb0ce9768604c6c033a5fad5c8da5 --- /dev/null +++ b/tasks/agg-p26-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 4, 12, 20, 21, 36]' > "$answer" diff --git a/tasks/agg-p26-n06-s05/task.toml b/tasks/agg-p26-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..479016f2431c476f286381d5ba15c50b5b16ef9c --- /dev/null +++ b/tasks/agg-p26-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n06-s05/tests/expected.json b/tasks/agg-p26-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0fde749c513429596321605fbb2f5b79808077a5 --- /dev/null +++ b/tasks/agg-p26-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[1, 4, 12, 20, 21, 36] diff --git a/tasks/agg-p26-n06-s05/tests/test.sh b/tasks/agg-p26-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n06-s06/instruction.md b/tasks/agg-p26-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..64ac36448e2dbf7956db9f18492ddc2ab2e6610f --- /dev/null +++ b/tasks/agg-p26-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twelve. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n06-s06/solution/solve.sh b/tasks/agg-p26-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7b6cfcb9229bb0ce9768604c6c033a5fad5c8da5 --- /dev/null +++ b/tasks/agg-p26-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 4, 12, 20, 21, 36]' > "$answer" diff --git a/tasks/agg-p26-n06-s06/task.toml b/tasks/agg-p26-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..959a98120070a11ec852d0d6b9f0767ffcb442a0 --- /dev/null +++ b/tasks/agg-p26-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n06-s06/tests/expected.json b/tasks/agg-p26-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..0fde749c513429596321605fbb2f5b79808077a5 --- /dev/null +++ b/tasks/agg-p26-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[1, 4, 12, 20, 21, 36] diff --git a/tasks/agg-p26-n06-s06/tests/test.sh b/tasks/agg-p26-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n08-s01/instruction.md b/tasks/agg-p26-n08-s01/instruction.md index 05e06432c2ceb1d2a551c09739142cd0234ce3f1..889d2dafb4224e178c94c3b71f63f598a82938ca 100644 --- a/tasks/agg-p26-n08-s01/instruction.md +++ b/tasks/agg-p26-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n08-s01/tests/test.sh b/tasks/agg-p26-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n08-s01/tests/test.sh +++ b/tasks/agg-p26-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n08-s02/instruction.md b/tasks/agg-p26-n08-s02/instruction.md index 45eef35ac00156eccf1849f3e7ce1978b9164536..e36fc7742cbb8f0fb0f25695cdfaa81e0348306d 100644 --- a/tasks/agg-p26-n08-s02/instruction.md +++ b/tasks/agg-p26-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n08-s02/tests/test.sh b/tasks/agg-p26-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n08-s02/tests/test.sh +++ b/tasks/agg-p26-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n08-s03/instruction.md b/tasks/agg-p26-n08-s03/instruction.md index 26ddb6283c1971f9d81edaec183ef7aadd75290a..3ac56c4ea8687b7dfe32e2c55bd3311e97d6944e 100644 --- a/tasks/agg-p26-n08-s03/instruction.md +++ b/tasks/agg-p26-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n08-s03/tests/test.sh b/tasks/agg-p26-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n08-s03/tests/test.sh +++ b/tasks/agg-p26-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n08-s04/instruction.md b/tasks/agg-p26-n08-s04/instruction.md index e45426f396d954e1affff91de56f66666add7d1c..9ac975d854c3ed506df0f5fe496fd94a52739e55 100644 --- a/tasks/agg-p26-n08-s04/instruction.md +++ b/tasks/agg-p26-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n08-s04/tests/test.sh b/tasks/agg-p26-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n08-s04/tests/test.sh +++ b/tasks/agg-p26-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n08-s05/instruction.md b/tasks/agg-p26-n08-s05/instruction.md index 4eccb674ece1f5e87026a82210d8ef4929435c03..1c8272e27cf6f88e7404b4647a540b918219e839 100644 --- a/tasks/agg-p26-n08-s05/instruction.md +++ b/tasks/agg-p26-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n08-s05/tests/test.sh b/tasks/agg-p26-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n08-s05/tests/test.sh +++ b/tasks/agg-p26-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n08-s06/instruction.md b/tasks/agg-p26-n08-s06/instruction.md index a94aeebf9e8286b30025fd530a9c33d5587c12ad..cf4266e28b21bdd50d23c3824ddaec94fe1bd8d5 100644 --- a/tasks/agg-p26-n08-s06/instruction.md +++ b/tasks/agg-p26-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n08-s06/tests/test.sh b/tasks/agg-p26-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n08-s06/tests/test.sh +++ b/tasks/agg-p26-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n08-s07/instruction.md b/tasks/agg-p26-n08-s07/instruction.md index d28771240990d9554944b9ef68d9203e0acd7f13..99290acfb8baa2927750e2841040ecf9ddb5f1fa 100644 --- a/tasks/agg-p26-n08-s07/instruction.md +++ b/tasks/agg-p26-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n08-s07/tests/test.sh b/tasks/agg-p26-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n08-s07/tests/test.sh +++ b/tasks/agg-p26-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n08-s08/instruction.md b/tasks/agg-p26-n08-s08/instruction.md index ec71f13b5946962c63788849abcae6208cb70629..ef1dffc1dcd1591d345fdae84de25e3aec26953a 100644 --- a/tasks/agg-p26-n08-s08/instruction.md +++ b/tasks/agg-p26-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n08-s08/tests/test.sh b/tasks/agg-p26-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n08-s08/tests/test.sh +++ b/tasks/agg-p26-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n12-s01/instruction.md b/tasks/agg-p26-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0b81ba6377af99eb65b5b6131fb2d1747a9214e3 --- /dev/null +++ b/tasks/agg-p26-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n12-s01/solution/solve.sh b/tasks/agg-p26-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d377e7995c07af2fb0aff1e9bea0ac4886fc457c --- /dev/null +++ b/tasks/agg-p26-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97]' > "$answer" diff --git a/tasks/agg-p26-n12-s01/task.toml b/tasks/agg-p26-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8bb44d4ea9a3e70b8b646472872dddcd5552f331 --- /dev/null +++ b/tasks/agg-p26-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n12-s01/tests/expected.json b/tasks/agg-p26-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..afc2705ec7f6d19893f138e0767344eb09553edc --- /dev/null +++ b/tasks/agg-p26-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97] diff --git a/tasks/agg-p26-n12-s01/tests/test.sh b/tasks/agg-p26-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n12-s02/instruction.md b/tasks/agg-p26-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cceebebec44b442f3530d40bdabf89079a1da1a4 --- /dev/null +++ b/tasks/agg-p26-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n12-s02/solution/solve.sh b/tasks/agg-p26-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d377e7995c07af2fb0aff1e9bea0ac4886fc457c --- /dev/null +++ b/tasks/agg-p26-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97]' > "$answer" diff --git a/tasks/agg-p26-n12-s02/task.toml b/tasks/agg-p26-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..aab6fc961f9bf97b782c7a2ed5c310e24a1d5a2b --- /dev/null +++ b/tasks/agg-p26-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n12-s02/tests/expected.json b/tasks/agg-p26-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..afc2705ec7f6d19893f138e0767344eb09553edc --- /dev/null +++ b/tasks/agg-p26-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97] diff --git a/tasks/agg-p26-n12-s02/tests/test.sh b/tasks/agg-p26-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n12-s03/instruction.md b/tasks/agg-p26-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..519523fa549585a9595ce676c83c5ebd96f5e138 --- /dev/null +++ b/tasks/agg-p26-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n12-s03/solution/solve.sh b/tasks/agg-p26-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d377e7995c07af2fb0aff1e9bea0ac4886fc457c --- /dev/null +++ b/tasks/agg-p26-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97]' > "$answer" diff --git a/tasks/agg-p26-n12-s03/task.toml b/tasks/agg-p26-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..59964cb9f5af654aefba15698b6ec686ad9e89d0 --- /dev/null +++ b/tasks/agg-p26-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n12-s03/tests/expected.json b/tasks/agg-p26-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..afc2705ec7f6d19893f138e0767344eb09553edc --- /dev/null +++ b/tasks/agg-p26-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97] diff --git a/tasks/agg-p26-n12-s03/tests/test.sh b/tasks/agg-p26-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n12-s04/instruction.md b/tasks/agg-p26-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..858fd908139109c01cfa1d8e481e4eba9092e0b5 --- /dev/null +++ b/tasks/agg-p26-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n12-s04/solution/solve.sh b/tasks/agg-p26-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d377e7995c07af2fb0aff1e9bea0ac4886fc457c --- /dev/null +++ b/tasks/agg-p26-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97]' > "$answer" diff --git a/tasks/agg-p26-n12-s04/task.toml b/tasks/agg-p26-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e923614f66a4f6055f8caf1130a23d08076df706 --- /dev/null +++ b/tasks/agg-p26-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n12-s04/tests/expected.json b/tasks/agg-p26-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..afc2705ec7f6d19893f138e0767344eb09553edc --- /dev/null +++ b/tasks/agg-p26-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97] diff --git a/tasks/agg-p26-n12-s04/tests/test.sh b/tasks/agg-p26-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n12-s05/instruction.md b/tasks/agg-p26-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9aaef5446517a1b0321eb9b44f6a98f04db290b5 --- /dev/null +++ b/tasks/agg-p26-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n12-s05/solution/solve.sh b/tasks/agg-p26-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d377e7995c07af2fb0aff1e9bea0ac4886fc457c --- /dev/null +++ b/tasks/agg-p26-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97]' > "$answer" diff --git a/tasks/agg-p26-n12-s05/task.toml b/tasks/agg-p26-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1be0a7e6437505c1f3d358459fb067bf591c2508 --- /dev/null +++ b/tasks/agg-p26-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n12-s05/tests/expected.json b/tasks/agg-p26-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..afc2705ec7f6d19893f138e0767344eb09553edc --- /dev/null +++ b/tasks/agg-p26-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97] diff --git a/tasks/agg-p26-n12-s05/tests/test.sh b/tasks/agg-p26-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n12-s06/instruction.md b/tasks/agg-p26-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cbefd6b3434fac66c24e06d94b9c3c278b95dbfb --- /dev/null +++ b/tasks/agg-p26-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twelve. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n12-s06/solution/solve.sh b/tasks/agg-p26-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d377e7995c07af2fb0aff1e9bea0ac4886fc457c --- /dev/null +++ b/tasks/agg-p26-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97]' > "$answer" diff --git a/tasks/agg-p26-n12-s06/task.toml b/tasks/agg-p26-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1865ba142d7c9183cb01c2f1279dfe7e7515354e --- /dev/null +++ b/tasks/agg-p26-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n12-s06/tests/expected.json b/tasks/agg-p26-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..afc2705ec7f6d19893f138e0767344eb09553edc --- /dev/null +++ b/tasks/agg-p26-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97] diff --git a/tasks/agg-p26-n12-s06/tests/test.sh b/tasks/agg-p26-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n12-s07/instruction.md b/tasks/agg-p26-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f8a7f84dc10e74d2d1efa1c93d0465b237cf01e --- /dev/null +++ b/tasks/agg-p26-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n12-s07/solution/solve.sh b/tasks/agg-p26-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d377e7995c07af2fb0aff1e9bea0ac4886fc457c --- /dev/null +++ b/tasks/agg-p26-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97]' > "$answer" diff --git a/tasks/agg-p26-n12-s07/task.toml b/tasks/agg-p26-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5d26d800237c2623c57be99f58a3592f21ec9dd7 --- /dev/null +++ b/tasks/agg-p26-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n12-s07/tests/expected.json b/tasks/agg-p26-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..afc2705ec7f6d19893f138e0767344eb09553edc --- /dev/null +++ b/tasks/agg-p26-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97] diff --git a/tasks/agg-p26-n12-s07/tests/test.sh b/tasks/agg-p26-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n12-s08/instruction.md b/tasks/agg-p26-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6e844f7a3e8d345b3d28255a1eef90feb406b747 --- /dev/null +++ b/tasks/agg-p26-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n12-s08/solution/solve.sh b/tasks/agg-p26-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d377e7995c07af2fb0aff1e9bea0ac4886fc457c --- /dev/null +++ b/tasks/agg-p26-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97]' > "$answer" diff --git a/tasks/agg-p26-n12-s08/task.toml b/tasks/agg-p26-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4a168203b76129453e6c2a6d086e80cbab5d6d91 --- /dev/null +++ b/tasks/agg-p26-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n12-s08/tests/expected.json b/tasks/agg-p26-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..afc2705ec7f6d19893f138e0767344eb09553edc --- /dev/null +++ b/tasks/agg-p26-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97] diff --git a/tasks/agg-p26-n12-s08/tests/test.sh b/tasks/agg-p26-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n12-s09/instruction.md b/tasks/agg-p26-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cb263587194e13f40f0ac806e2318a121b31d15a --- /dev/null +++ b/tasks/agg-p26-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n12-s09/solution/solve.sh b/tasks/agg-p26-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d377e7995c07af2fb0aff1e9bea0ac4886fc457c --- /dev/null +++ b/tasks/agg-p26-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97]' > "$answer" diff --git a/tasks/agg-p26-n12-s09/task.toml b/tasks/agg-p26-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c2a3e8e672366826275863946ccdd26434cf1ec9 --- /dev/null +++ b/tasks/agg-p26-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n12-s09/tests/expected.json b/tasks/agg-p26-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..afc2705ec7f6d19893f138e0767344eb09553edc --- /dev/null +++ b/tasks/agg-p26-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97] diff --git a/tasks/agg-p26-n12-s09/tests/test.sh b/tasks/agg-p26-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n12-s10/instruction.md b/tasks/agg-p26-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..afc44302e5446bbcbad60907a837f2fdde13fc15 --- /dev/null +++ b/tasks/agg-p26-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n12-s10/solution/solve.sh b/tasks/agg-p26-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d377e7995c07af2fb0aff1e9bea0ac4886fc457c --- /dev/null +++ b/tasks/agg-p26-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97]' > "$answer" diff --git a/tasks/agg-p26-n12-s10/task.toml b/tasks/agg-p26-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..80af6f124d3be5dad4a882dbdd32977606f6f3ba --- /dev/null +++ b/tasks/agg-p26-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n12-s10/tests/expected.json b/tasks/agg-p26-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..afc2705ec7f6d19893f138e0767344eb09553edc --- /dev/null +++ b/tasks/agg-p26-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97] diff --git a/tasks/agg-p26-n12-s10/tests/test.sh b/tasks/agg-p26-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n12-s11/instruction.md b/tasks/agg-p26-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..02901bb1828d807a2d28e8fb148344dbe048c353 --- /dev/null +++ b/tasks/agg-p26-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n12-s11/solution/solve.sh b/tasks/agg-p26-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d377e7995c07af2fb0aff1e9bea0ac4886fc457c --- /dev/null +++ b/tasks/agg-p26-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97]' > "$answer" diff --git a/tasks/agg-p26-n12-s11/task.toml b/tasks/agg-p26-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a5e18861dc1329d22623fbf345478d9c43763e4b --- /dev/null +++ b/tasks/agg-p26-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n12-s11/tests/expected.json b/tasks/agg-p26-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..afc2705ec7f6d19893f138e0767344eb09553edc --- /dev/null +++ b/tasks/agg-p26-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97] diff --git a/tasks/agg-p26-n12-s11/tests/test.sh b/tasks/agg-p26-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n12-s12/instruction.md b/tasks/agg-p26-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f4b49efc3c821e0d716e0443cac99bdb036d4e81 --- /dev/null +++ b/tasks/agg-p26-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n12-s12/solution/solve.sh b/tasks/agg-p26-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..d377e7995c07af2fb0aff1e9bea0ac4886fc457c --- /dev/null +++ b/tasks/agg-p26-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97]' > "$answer" diff --git a/tasks/agg-p26-n12-s12/task.toml b/tasks/agg-p26-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b10649230ff7e9b8ba789fcf0727dd2a5e2f383a --- /dev/null +++ b/tasks/agg-p26-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p26-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 26 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p26-n12-s12/tests/expected.json b/tasks/agg-p26-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..afc2705ec7f6d19893f138e0767344eb09553edc --- /dev/null +++ b/tasks/agg-p26-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[1, 2, 4, 12, 20, 21, 36, 37, 47, 66, 77, 97] diff --git a/tasks/agg-p26-n12-s12/tests/test.sh b/tasks/agg-p26-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p26-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p26-n16-s01/instruction.md b/tasks/agg-p26-n16-s01/instruction.md index 1499aaac42fb5c39eb3846670f67c71d3d44d289..b294d334efb52a9a07adec52a680b842f6ba6953 100644 --- a/tasks/agg-p26-n16-s01/instruction.md +++ b/tasks/agg-p26-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s01/tests/test.sh b/tasks/agg-p26-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s01/tests/test.sh +++ b/tasks/agg-p26-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s02/instruction.md b/tasks/agg-p26-n16-s02/instruction.md index 81577d14ed82fb21b17e0bd51c9dc2a594f0c1b6..02d90432252450a09c7a989f19e252e75078b8f6 100644 --- a/tasks/agg-p26-n16-s02/instruction.md +++ b/tasks/agg-p26-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s02/tests/test.sh b/tasks/agg-p26-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s02/tests/test.sh +++ b/tasks/agg-p26-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s03/instruction.md b/tasks/agg-p26-n16-s03/instruction.md index 9137a4ab46a628c60be0b75972f0a9947e2c3883..4c327201eb92082d75247de85279b2149f069a49 100644 --- a/tasks/agg-p26-n16-s03/instruction.md +++ b/tasks/agg-p26-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s03/tests/test.sh b/tasks/agg-p26-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s03/tests/test.sh +++ b/tasks/agg-p26-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s04/instruction.md b/tasks/agg-p26-n16-s04/instruction.md index 1a86ea7323aad3c91f00b65904f038f7e58f852d..d90a1687d9e29b3017d6bfd726c776fc6eece866 100644 --- a/tasks/agg-p26-n16-s04/instruction.md +++ b/tasks/agg-p26-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s04/tests/test.sh b/tasks/agg-p26-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s04/tests/test.sh +++ b/tasks/agg-p26-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s05/instruction.md b/tasks/agg-p26-n16-s05/instruction.md index 552ad7b188277feadeb521fd17ec24a6f1f8f5ae..50bdd007515ead22fc5cdc1b26c44d0d9cdd48d1 100644 --- a/tasks/agg-p26-n16-s05/instruction.md +++ b/tasks/agg-p26-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s05/tests/test.sh b/tasks/agg-p26-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s05/tests/test.sh +++ b/tasks/agg-p26-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s06/instruction.md b/tasks/agg-p26-n16-s06/instruction.md index 0d9b54e563f9bb163b48be34eb84abe311c00e06..ceda32fde53a1c10e904f97ed076f49abdf1f3a5 100644 --- a/tasks/agg-p26-n16-s06/instruction.md +++ b/tasks/agg-p26-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s06/tests/test.sh b/tasks/agg-p26-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s06/tests/test.sh +++ b/tasks/agg-p26-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s07/instruction.md b/tasks/agg-p26-n16-s07/instruction.md index 10bcc3d169e35738b1fb80abb7316f9cd7c1b230..254a759d5a0113deb55448c366676577f275a1f1 100644 --- a/tasks/agg-p26-n16-s07/instruction.md +++ b/tasks/agg-p26-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s07/tests/test.sh b/tasks/agg-p26-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s07/tests/test.sh +++ b/tasks/agg-p26-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s08/instruction.md b/tasks/agg-p26-n16-s08/instruction.md index bec568d59f85e2e30c1eb04f810b7ec136113a04..d047a7120223676abdd7f02b0240a56c724e3fff 100644 --- a/tasks/agg-p26-n16-s08/instruction.md +++ b/tasks/agg-p26-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s08/tests/test.sh b/tasks/agg-p26-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s08/tests/test.sh +++ b/tasks/agg-p26-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s09/instruction.md b/tasks/agg-p26-n16-s09/instruction.md index b591b84320df9e123e22bd4301725691d49ea0a1..7f4d0ff076a0dba3c67021ed8791edf69a2b7c7b 100644 --- a/tasks/agg-p26-n16-s09/instruction.md +++ b/tasks/agg-p26-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s09/tests/test.sh b/tasks/agg-p26-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s09/tests/test.sh +++ b/tasks/agg-p26-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s10/instruction.md b/tasks/agg-p26-n16-s10/instruction.md index ebbf18dd1885eca56e4b99d9ba0f301603987c59..967cbe42235491e28138a2858f78709704a1bd82 100644 --- a/tasks/agg-p26-n16-s10/instruction.md +++ b/tasks/agg-p26-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s10/tests/test.sh b/tasks/agg-p26-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s10/tests/test.sh +++ b/tasks/agg-p26-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s11/instruction.md b/tasks/agg-p26-n16-s11/instruction.md index 2b88f98c808d50d8812e112db76251266368fe80..3162a9d23282256e321282ae9170e9de281da28f 100644 --- a/tasks/agg-p26-n16-s11/instruction.md +++ b/tasks/agg-p26-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s11/tests/test.sh b/tasks/agg-p26-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s11/tests/test.sh +++ b/tasks/agg-p26-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s12/instruction.md b/tasks/agg-p26-n16-s12/instruction.md index 3a10e21a080f18532e8e18935bc65496e13588a2..3b81386b59fb88e5b2c11fc6768f76e2b16d0fe9 100644 --- a/tasks/agg-p26-n16-s12/instruction.md +++ b/tasks/agg-p26-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s12/tests/test.sh b/tasks/agg-p26-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s12/tests/test.sh +++ b/tasks/agg-p26-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s13/instruction.md b/tasks/agg-p26-n16-s13/instruction.md index 9dba8fcd9b2fce59a48316fb46a93570155cc398..fec7193f715ccf2092f0fe956e70ae778f0f8ae7 100644 --- a/tasks/agg-p26-n16-s13/instruction.md +++ b/tasks/agg-p26-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s13/tests/test.sh b/tasks/agg-p26-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s13/tests/test.sh +++ b/tasks/agg-p26-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s14/instruction.md b/tasks/agg-p26-n16-s14/instruction.md index dbf2061d7fb14b0259a175fc5733c9416d2923e1..c504d6aa634b53ffe7cd9828aca879ab0d12da11 100644 --- a/tasks/agg-p26-n16-s14/instruction.md +++ b/tasks/agg-p26-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s14/tests/test.sh b/tasks/agg-p26-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s14/tests/test.sh +++ b/tasks/agg-p26-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s15/instruction.md b/tasks/agg-p26-n16-s15/instruction.md index ac5d07700d94f2ac8dcfe94fa7b7a0669218f24c..b6fbdfaa15c801714d533bc10b7c3a21161186fb 100644 --- a/tasks/agg-p26-n16-s15/instruction.md +++ b/tasks/agg-p26-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s15/tests/test.sh b/tasks/agg-p26-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s15/tests/test.sh +++ b/tasks/agg-p26-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p26-n16-s16/instruction.md b/tasks/agg-p26-n16-s16/instruction.md index e291fbc977a39d7840cab85af303fe0db4b788af..fd4749e73869d5bc6d1d79fb31331e73e6166413 100644 --- a/tasks/agg-p26-n16-s16/instruction.md +++ b/tasks/agg-p26-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p26-n16-s16/tests/test.sh b/tasks/agg-p26-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p26-n16-s16/tests/test.sh +++ b/tasks/agg-p26-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n01-s01/instruction.md b/tasks/agg-p27-n01-s01/instruction.md index 6a2c81ef934cf714c932621511512f5d3e6b1954..52bfe170839bc394213cf2c804ac3870306ce800 100644 --- a/tasks/agg-p27-n01-s01/instruction.md +++ b/tasks/agg-p27-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is ninety-nine. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p27-n01-s01/tests/test.sh b/tasks/agg-p27-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n01-s01/tests/test.sh +++ b/tasks/agg-p27-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n02-s01/instruction.md b/tasks/agg-p27-n02-s01/instruction.md index 56fbccdd9a63af0fa1bfd79a2e0805fe45045610..24f75c77fe7ad81332336706dd434fe8eab9acf2 100644 --- a/tasks/agg-p27-n02-s01/instruction.md +++ b/tasks/agg-p27-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n02-s01/tests/test.sh b/tasks/agg-p27-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n02-s01/tests/test.sh +++ b/tasks/agg-p27-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n02-s02/instruction.md b/tasks/agg-p27-n02-s02/instruction.md index 7a085c11762d40ab9680a66adcd3e6c74e0f813f..a2eea2af09e4013444d05facdcbb139ee37c32c2 100644 --- a/tasks/agg-p27-n02-s02/instruction.md +++ b/tasks/agg-p27-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n02-s02/tests/test.sh b/tasks/agg-p27-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n02-s02/tests/test.sh +++ b/tasks/agg-p27-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n04-s01/instruction.md b/tasks/agg-p27-n04-s01/instruction.md index 6307290f651da6caca15cac718400c269975a355..9729d2ee1413d947811bea7f081d3d36853e0442 100644 --- a/tasks/agg-p27-n04-s01/instruction.md +++ b/tasks/agg-p27-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n04-s01/tests/test.sh b/tasks/agg-p27-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n04-s01/tests/test.sh +++ b/tasks/agg-p27-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n04-s02/instruction.md b/tasks/agg-p27-n04-s02/instruction.md index 16706302237fc8392949449eb048f6bb027a022c..fffa58b02b15fcff7eee47d23096045d666f7865 100644 --- a/tasks/agg-p27-n04-s02/instruction.md +++ b/tasks/agg-p27-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n04-s02/tests/test.sh b/tasks/agg-p27-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n04-s02/tests/test.sh +++ b/tasks/agg-p27-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n04-s03/instruction.md b/tasks/agg-p27-n04-s03/instruction.md index 5985fe79f84ad8d3bd05e5f2cb65788b96c4d962..80dc80a9b419d42463e357566022067b2538764b 100644 --- a/tasks/agg-p27-n04-s03/instruction.md +++ b/tasks/agg-p27-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n04-s03/tests/test.sh b/tasks/agg-p27-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n04-s03/tests/test.sh +++ b/tasks/agg-p27-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n04-s04/instruction.md b/tasks/agg-p27-n04-s04/instruction.md index 861fe1fef00423e5f645a688c63a473579cf4cf3..fced5a4a6107d08d8b6fe321f29fc874df759613 100644 --- a/tasks/agg-p27-n04-s04/instruction.md +++ b/tasks/agg-p27-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n04-s04/tests/test.sh b/tasks/agg-p27-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n04-s04/tests/test.sh +++ b/tasks/agg-p27-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n06-s01/instruction.md b/tasks/agg-p27-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2da0c8e2076394d2c2f2270ad3b964940d1e2f12 --- /dev/null +++ b/tasks/agg-p27-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n06-s01/solution/solve.sh b/tasks/agg-p27-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a0b1cb6848beb9dff31a0b420f12e1d387584f73 --- /dev/null +++ b/tasks/agg-p27-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[14, 15, 74, 86, 95, 99]' > "$answer" diff --git a/tasks/agg-p27-n06-s01/task.toml b/tasks/agg-p27-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8484d35d4bcca2d41aed7c88497b5679ccb3f9c6 --- /dev/null +++ b/tasks/agg-p27-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n06-s01/tests/expected.json b/tasks/agg-p27-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..441a136206e31bb1a15d4a253b45a49e5ee74d36 --- /dev/null +++ b/tasks/agg-p27-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[14, 15, 74, 86, 95, 99] diff --git a/tasks/agg-p27-n06-s01/tests/test.sh b/tasks/agg-p27-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n06-s02/instruction.md b/tasks/agg-p27-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..938ca4fa446ac3bc537124ef6fffa0d68ee759cb --- /dev/null +++ b/tasks/agg-p27-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n06-s02/solution/solve.sh b/tasks/agg-p27-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a0b1cb6848beb9dff31a0b420f12e1d387584f73 --- /dev/null +++ b/tasks/agg-p27-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[14, 15, 74, 86, 95, 99]' > "$answer" diff --git a/tasks/agg-p27-n06-s02/task.toml b/tasks/agg-p27-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..65a95a00d098e29fddc27b55d32dc17daf44d645 --- /dev/null +++ b/tasks/agg-p27-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n06-s02/tests/expected.json b/tasks/agg-p27-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..441a136206e31bb1a15d4a253b45a49e5ee74d36 --- /dev/null +++ b/tasks/agg-p27-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[14, 15, 74, 86, 95, 99] diff --git a/tasks/agg-p27-n06-s02/tests/test.sh b/tasks/agg-p27-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n06-s03/instruction.md b/tasks/agg-p27-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7de047c5dfa2d2d4687c682be1e69dda63d15edb --- /dev/null +++ b/tasks/agg-p27-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n06-s03/solution/solve.sh b/tasks/agg-p27-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a0b1cb6848beb9dff31a0b420f12e1d387584f73 --- /dev/null +++ b/tasks/agg-p27-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[14, 15, 74, 86, 95, 99]' > "$answer" diff --git a/tasks/agg-p27-n06-s03/task.toml b/tasks/agg-p27-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..da39af29a897cb905f3e836b31cf47d3e75aa891 --- /dev/null +++ b/tasks/agg-p27-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n06-s03/tests/expected.json b/tasks/agg-p27-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..441a136206e31bb1a15d4a253b45a49e5ee74d36 --- /dev/null +++ b/tasks/agg-p27-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[14, 15, 74, 86, 95, 99] diff --git a/tasks/agg-p27-n06-s03/tests/test.sh b/tasks/agg-p27-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n06-s04/instruction.md b/tasks/agg-p27-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..dc81e7d9c7fcb605ef3de973a2527bf92800a8d5 --- /dev/null +++ b/tasks/agg-p27-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifteen. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n06-s04/solution/solve.sh b/tasks/agg-p27-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a0b1cb6848beb9dff31a0b420f12e1d387584f73 --- /dev/null +++ b/tasks/agg-p27-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[14, 15, 74, 86, 95, 99]' > "$answer" diff --git a/tasks/agg-p27-n06-s04/task.toml b/tasks/agg-p27-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e8560adcd905de6646fc3d5f3fdacabdf18dfa78 --- /dev/null +++ b/tasks/agg-p27-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n06-s04/tests/expected.json b/tasks/agg-p27-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..441a136206e31bb1a15d4a253b45a49e5ee74d36 --- /dev/null +++ b/tasks/agg-p27-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[14, 15, 74, 86, 95, 99] diff --git a/tasks/agg-p27-n06-s04/tests/test.sh b/tasks/agg-p27-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n06-s05/instruction.md b/tasks/agg-p27-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0b461db6cddc79d232d863d9965ea2356a32c620 --- /dev/null +++ b/tasks/agg-p27-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fourteen. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n06-s05/solution/solve.sh b/tasks/agg-p27-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a0b1cb6848beb9dff31a0b420f12e1d387584f73 --- /dev/null +++ b/tasks/agg-p27-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[14, 15, 74, 86, 95, 99]' > "$answer" diff --git a/tasks/agg-p27-n06-s05/task.toml b/tasks/agg-p27-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b0a4a28183a9618c2fc82999955ca57c3f92c5ed --- /dev/null +++ b/tasks/agg-p27-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n06-s05/tests/expected.json b/tasks/agg-p27-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..441a136206e31bb1a15d4a253b45a49e5ee74d36 --- /dev/null +++ b/tasks/agg-p27-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[14, 15, 74, 86, 95, 99] diff --git a/tasks/agg-p27-n06-s05/tests/test.sh b/tasks/agg-p27-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n06-s06/instruction.md b/tasks/agg-p27-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6edae5a0cf2c4c0ea01e4142c514ceefe0b054da --- /dev/null +++ b/tasks/agg-p27-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n06-s06/solution/solve.sh b/tasks/agg-p27-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..a0b1cb6848beb9dff31a0b420f12e1d387584f73 --- /dev/null +++ b/tasks/agg-p27-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[14, 15, 74, 86, 95, 99]' > "$answer" diff --git a/tasks/agg-p27-n06-s06/task.toml b/tasks/agg-p27-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..23c5b24df1291b4b001741478df6ad3f70f43cec --- /dev/null +++ b/tasks/agg-p27-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n06-s06/tests/expected.json b/tasks/agg-p27-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..441a136206e31bb1a15d4a253b45a49e5ee74d36 --- /dev/null +++ b/tasks/agg-p27-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[14, 15, 74, 86, 95, 99] diff --git a/tasks/agg-p27-n06-s06/tests/test.sh b/tasks/agg-p27-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n08-s01/instruction.md b/tasks/agg-p27-n08-s01/instruction.md index 20c75cc16db467c29e541a706205beed9fbbe75d..fa30070f61094288c088b08bfc8b901d9e75a2c6 100644 --- a/tasks/agg-p27-n08-s01/instruction.md +++ b/tasks/agg-p27-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n08-s01/tests/test.sh b/tasks/agg-p27-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n08-s01/tests/test.sh +++ b/tasks/agg-p27-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n08-s02/instruction.md b/tasks/agg-p27-n08-s02/instruction.md index 5dfaf37489d6796e9a47f9dfca5402a1e39e51c2..682c7dbeddcd1c70522b5a7ef3b28dc65cfad7d4 100644 --- a/tasks/agg-p27-n08-s02/instruction.md +++ b/tasks/agg-p27-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n08-s02/tests/test.sh b/tasks/agg-p27-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n08-s02/tests/test.sh +++ b/tasks/agg-p27-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n08-s03/instruction.md b/tasks/agg-p27-n08-s03/instruction.md index 886bc72662ab9eb339369a28cc3322cfbb3eaa89..b408160ded02b305a1041d2ca3291e96767416f1 100644 --- a/tasks/agg-p27-n08-s03/instruction.md +++ b/tasks/agg-p27-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n08-s03/tests/test.sh b/tasks/agg-p27-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n08-s03/tests/test.sh +++ b/tasks/agg-p27-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n08-s04/instruction.md b/tasks/agg-p27-n08-s04/instruction.md index 27a8e1bd50be0cdbb7d7c6e5b7370ea7a88e7623..1e33aeee51a9a4d728e4588929a0d66b9457a8bb 100644 --- a/tasks/agg-p27-n08-s04/instruction.md +++ b/tasks/agg-p27-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n08-s04/tests/test.sh b/tasks/agg-p27-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n08-s04/tests/test.sh +++ b/tasks/agg-p27-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n08-s05/instruction.md b/tasks/agg-p27-n08-s05/instruction.md index 54d881d3c1889509c322ddf6355b6cd34a504304..6f6241871bd4db6009f6523f0ed2321a59f5ed3f 100644 --- a/tasks/agg-p27-n08-s05/instruction.md +++ b/tasks/agg-p27-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n08-s05/tests/test.sh b/tasks/agg-p27-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n08-s05/tests/test.sh +++ b/tasks/agg-p27-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n08-s06/instruction.md b/tasks/agg-p27-n08-s06/instruction.md index a042cb763ccdabe4fefaa1c5911478c0a369e6d0..404dd56dd7f109b5fe4e8b8fdcf1e15a36a23e04 100644 --- a/tasks/agg-p27-n08-s06/instruction.md +++ b/tasks/agg-p27-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n08-s06/tests/test.sh b/tasks/agg-p27-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n08-s06/tests/test.sh +++ b/tasks/agg-p27-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n08-s07/instruction.md b/tasks/agg-p27-n08-s07/instruction.md index adf076239d22dc26d4ec229af4da31fbc03ac3bf..11e0ef6eb1150d38f2eb00e00c3d0941f60bc8ed 100644 --- a/tasks/agg-p27-n08-s07/instruction.md +++ b/tasks/agg-p27-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n08-s07/tests/test.sh b/tasks/agg-p27-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n08-s07/tests/test.sh +++ b/tasks/agg-p27-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n08-s08/instruction.md b/tasks/agg-p27-n08-s08/instruction.md index 18a0c74cfce99ad5836ee2b774dc98589cdf30c9..724a50f59f856193f3ee8ad08d6dc8cb138f3eaf 100644 --- a/tasks/agg-p27-n08-s08/instruction.md +++ b/tasks/agg-p27-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n08-s08/tests/test.sh b/tasks/agg-p27-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n08-s08/tests/test.sh +++ b/tasks/agg-p27-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n12-s01/instruction.md b/tasks/agg-p27-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..40f3f7e13cfd3a8040e44274dd1b8429c6804923 --- /dev/null +++ b/tasks/agg-p27-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n12-s01/solution/solve.sh b/tasks/agg-p27-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..007e0f57c0f3371f13c934ca0cde54dcdf961237 --- /dev/null +++ b/tasks/agg-p27-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99]' > "$answer" diff --git a/tasks/agg-p27-n12-s01/task.toml b/tasks/agg-p27-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..faef380328d12d00d9e59e6e97e3e36933dc601e --- /dev/null +++ b/tasks/agg-p27-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n12-s01/tests/expected.json b/tasks/agg-p27-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a167167c6741319166bf4767a285e45aec6d3490 --- /dev/null +++ b/tasks/agg-p27-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99] diff --git a/tasks/agg-p27-n12-s01/tests/test.sh b/tasks/agg-p27-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n12-s02/instruction.md b/tasks/agg-p27-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f7bc3051e09aa70b286064fc6302e7e968c525e --- /dev/null +++ b/tasks/agg-p27-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n12-s02/solution/solve.sh b/tasks/agg-p27-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..007e0f57c0f3371f13c934ca0cde54dcdf961237 --- /dev/null +++ b/tasks/agg-p27-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99]' > "$answer" diff --git a/tasks/agg-p27-n12-s02/task.toml b/tasks/agg-p27-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..00e5bf7c390a72828e998d3c45b2e5c7dd92b2fd --- /dev/null +++ b/tasks/agg-p27-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n12-s02/tests/expected.json b/tasks/agg-p27-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a167167c6741319166bf4767a285e45aec6d3490 --- /dev/null +++ b/tasks/agg-p27-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99] diff --git a/tasks/agg-p27-n12-s02/tests/test.sh b/tasks/agg-p27-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n12-s03/instruction.md b/tasks/agg-p27-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..71e4b46f8ef6c0e175e49cbd3404e539262eb6fd --- /dev/null +++ b/tasks/agg-p27-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n12-s03/solution/solve.sh b/tasks/agg-p27-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..007e0f57c0f3371f13c934ca0cde54dcdf961237 --- /dev/null +++ b/tasks/agg-p27-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99]' > "$answer" diff --git a/tasks/agg-p27-n12-s03/task.toml b/tasks/agg-p27-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d4bac1faa4b0153548340b0f1ac4ed36ba5b8d6e --- /dev/null +++ b/tasks/agg-p27-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n12-s03/tests/expected.json b/tasks/agg-p27-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a167167c6741319166bf4767a285e45aec6d3490 --- /dev/null +++ b/tasks/agg-p27-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99] diff --git a/tasks/agg-p27-n12-s03/tests/test.sh b/tasks/agg-p27-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n12-s04/instruction.md b/tasks/agg-p27-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bcda533fb0b3407f78cfaf5c16a551ac6f72aead --- /dev/null +++ b/tasks/agg-p27-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n12-s04/solution/solve.sh b/tasks/agg-p27-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..007e0f57c0f3371f13c934ca0cde54dcdf961237 --- /dev/null +++ b/tasks/agg-p27-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99]' > "$answer" diff --git a/tasks/agg-p27-n12-s04/task.toml b/tasks/agg-p27-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..368c65e86bfe659e04c093c715f5aa909c8cf671 --- /dev/null +++ b/tasks/agg-p27-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n12-s04/tests/expected.json b/tasks/agg-p27-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a167167c6741319166bf4767a285e45aec6d3490 --- /dev/null +++ b/tasks/agg-p27-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99] diff --git a/tasks/agg-p27-n12-s04/tests/test.sh b/tasks/agg-p27-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n12-s05/instruction.md b/tasks/agg-p27-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1bb8f11690672412ad07a665fbb7f3d7d2ab1336 --- /dev/null +++ b/tasks/agg-p27-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fourteen. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n12-s05/solution/solve.sh b/tasks/agg-p27-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..007e0f57c0f3371f13c934ca0cde54dcdf961237 --- /dev/null +++ b/tasks/agg-p27-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99]' > "$answer" diff --git a/tasks/agg-p27-n12-s05/task.toml b/tasks/agg-p27-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..84383fcaa019fc5e8c7a76dff0fe4788852feda4 --- /dev/null +++ b/tasks/agg-p27-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n12-s05/tests/expected.json b/tasks/agg-p27-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a167167c6741319166bf4767a285e45aec6d3490 --- /dev/null +++ b/tasks/agg-p27-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99] diff --git a/tasks/agg-p27-n12-s05/tests/test.sh b/tasks/agg-p27-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n12-s06/instruction.md b/tasks/agg-p27-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f5aa8b70f2f447fb84dd6b26d80c8d7537bebefb --- /dev/null +++ b/tasks/agg-p27-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n12-s06/solution/solve.sh b/tasks/agg-p27-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..007e0f57c0f3371f13c934ca0cde54dcdf961237 --- /dev/null +++ b/tasks/agg-p27-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99]' > "$answer" diff --git a/tasks/agg-p27-n12-s06/task.toml b/tasks/agg-p27-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2ff43d3edec41f492ccaecc7b732147c2a469f74 --- /dev/null +++ b/tasks/agg-p27-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n12-s06/tests/expected.json b/tasks/agg-p27-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a167167c6741319166bf4767a285e45aec6d3490 --- /dev/null +++ b/tasks/agg-p27-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99] diff --git a/tasks/agg-p27-n12-s06/tests/test.sh b/tasks/agg-p27-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n12-s07/instruction.md b/tasks/agg-p27-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8cf648eaf9a4f546389931734c87680f9600280c --- /dev/null +++ b/tasks/agg-p27-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n12-s07/solution/solve.sh b/tasks/agg-p27-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..007e0f57c0f3371f13c934ca0cde54dcdf961237 --- /dev/null +++ b/tasks/agg-p27-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99]' > "$answer" diff --git a/tasks/agg-p27-n12-s07/task.toml b/tasks/agg-p27-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3fbc847fd2ca546f2202742d6d6f1b6340911387 --- /dev/null +++ b/tasks/agg-p27-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n12-s07/tests/expected.json b/tasks/agg-p27-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a167167c6741319166bf4767a285e45aec6d3490 --- /dev/null +++ b/tasks/agg-p27-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99] diff --git a/tasks/agg-p27-n12-s07/tests/test.sh b/tasks/agg-p27-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n12-s08/instruction.md b/tasks/agg-p27-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cb263587194e13f40f0ac806e2318a121b31d15a --- /dev/null +++ b/tasks/agg-p27-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n12-s08/solution/solve.sh b/tasks/agg-p27-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..007e0f57c0f3371f13c934ca0cde54dcdf961237 --- /dev/null +++ b/tasks/agg-p27-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99]' > "$answer" diff --git a/tasks/agg-p27-n12-s08/task.toml b/tasks/agg-p27-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ee79b2dc37f8ee49b628f6a4cc2e824b019a0832 --- /dev/null +++ b/tasks/agg-p27-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n12-s08/tests/expected.json b/tasks/agg-p27-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a167167c6741319166bf4767a285e45aec6d3490 --- /dev/null +++ b/tasks/agg-p27-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99] diff --git a/tasks/agg-p27-n12-s08/tests/test.sh b/tasks/agg-p27-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n12-s09/instruction.md b/tasks/agg-p27-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..94b2bafb52358803774fef0f96566ce593de1b99 --- /dev/null +++ b/tasks/agg-p27-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n12-s09/solution/solve.sh b/tasks/agg-p27-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..007e0f57c0f3371f13c934ca0cde54dcdf961237 --- /dev/null +++ b/tasks/agg-p27-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99]' > "$answer" diff --git a/tasks/agg-p27-n12-s09/task.toml b/tasks/agg-p27-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..643a2ed4b622350ddccd03198d3d26f8064f7054 --- /dev/null +++ b/tasks/agg-p27-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n12-s09/tests/expected.json b/tasks/agg-p27-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a167167c6741319166bf4767a285e45aec6d3490 --- /dev/null +++ b/tasks/agg-p27-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99] diff --git a/tasks/agg-p27-n12-s09/tests/test.sh b/tasks/agg-p27-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n12-s10/instruction.md b/tasks/agg-p27-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2f01a3e73dbd4b8b1058dd60451773afa73f14c7 --- /dev/null +++ b/tasks/agg-p27-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n12-s10/solution/solve.sh b/tasks/agg-p27-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..007e0f57c0f3371f13c934ca0cde54dcdf961237 --- /dev/null +++ b/tasks/agg-p27-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99]' > "$answer" diff --git a/tasks/agg-p27-n12-s10/task.toml b/tasks/agg-p27-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..99e924e204086d2a8faa4a3158a48d5e9e681247 --- /dev/null +++ b/tasks/agg-p27-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n12-s10/tests/expected.json b/tasks/agg-p27-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a167167c6741319166bf4767a285e45aec6d3490 --- /dev/null +++ b/tasks/agg-p27-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99] diff --git a/tasks/agg-p27-n12-s10/tests/test.sh b/tasks/agg-p27-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n12-s11/instruction.md b/tasks/agg-p27-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cbefd6b3434fac66c24e06d94b9c3c278b95dbfb --- /dev/null +++ b/tasks/agg-p27-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twelve. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n12-s11/solution/solve.sh b/tasks/agg-p27-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..007e0f57c0f3371f13c934ca0cde54dcdf961237 --- /dev/null +++ b/tasks/agg-p27-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99]' > "$answer" diff --git a/tasks/agg-p27-n12-s11/task.toml b/tasks/agg-p27-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6d68bbe4f0b49c3aca5cfb47417275c3fa34cac5 --- /dev/null +++ b/tasks/agg-p27-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n12-s11/tests/expected.json b/tasks/agg-p27-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a167167c6741319166bf4767a285e45aec6d3490 --- /dev/null +++ b/tasks/agg-p27-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99] diff --git a/tasks/agg-p27-n12-s11/tests/test.sh b/tasks/agg-p27-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n12-s12/instruction.md b/tasks/agg-p27-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ca689d19db465172c22b2b5dc9acaa4689858529 --- /dev/null +++ b/tasks/agg-p27-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n12-s12/solution/solve.sh b/tasks/agg-p27-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..007e0f57c0f3371f13c934ca0cde54dcdf961237 --- /dev/null +++ b/tasks/agg-p27-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99]' > "$answer" diff --git a/tasks/agg-p27-n12-s12/task.toml b/tasks/agg-p27-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..28cf6c91d5c4a796b2536fab69b88cbd10aa2f00 --- /dev/null +++ b/tasks/agg-p27-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p27-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 27 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p27-n12-s12/tests/expected.json b/tasks/agg-p27-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..a167167c6741319166bf4767a285e45aec6d3490 --- /dev/null +++ b/tasks/agg-p27-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[12, 14, 15, 47, 56, 74, 83, 86, 88, 95, 96, 99] diff --git a/tasks/agg-p27-n12-s12/tests/test.sh b/tasks/agg-p27-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p27-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p27-n16-s01/instruction.md b/tasks/agg-p27-n16-s01/instruction.md index e5e3f1447d4ff13fe5188dafc1b5104a3c8f0e59..f9fc0a05d4cbd2084dc7f80c349485aae4d72692 100644 --- a/tasks/agg-p27-n16-s01/instruction.md +++ b/tasks/agg-p27-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s01/tests/test.sh b/tasks/agg-p27-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s01/tests/test.sh +++ b/tasks/agg-p27-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s02/instruction.md b/tasks/agg-p27-n16-s02/instruction.md index bb8416d585abe15f78ad9eaf98f78cbb202e2f9a..d2b26950540de67dd00f1a8d6c3d9b9c9c52ddf0 100644 --- a/tasks/agg-p27-n16-s02/instruction.md +++ b/tasks/agg-p27-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s02/tests/test.sh b/tasks/agg-p27-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s02/tests/test.sh +++ b/tasks/agg-p27-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s03/instruction.md b/tasks/agg-p27-n16-s03/instruction.md index 07c9e57a88a9821b15aef8e576670581ef52b8cf..f17e7c1550785116b92d6c8da78aeb05d8edf6c0 100644 --- a/tasks/agg-p27-n16-s03/instruction.md +++ b/tasks/agg-p27-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s03/tests/test.sh b/tasks/agg-p27-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s03/tests/test.sh +++ b/tasks/agg-p27-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s04/instruction.md b/tasks/agg-p27-n16-s04/instruction.md index 7cf63660731cfb255f4030930d1fa31a717d902f..6dab277b2fabfee8f34045a8f6fb47ac3384734d 100644 --- a/tasks/agg-p27-n16-s04/instruction.md +++ b/tasks/agg-p27-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s04/tests/test.sh b/tasks/agg-p27-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s04/tests/test.sh +++ b/tasks/agg-p27-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s05/instruction.md b/tasks/agg-p27-n16-s05/instruction.md index 63a1a563a0b3abdd4e128d86f97d0a2fb0ea5c9e..7bc3e049121a5282217af4b5cf2ab2b62234a6ec 100644 --- a/tasks/agg-p27-n16-s05/instruction.md +++ b/tasks/agg-p27-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s05/tests/test.sh b/tasks/agg-p27-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s05/tests/test.sh +++ b/tasks/agg-p27-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s06/instruction.md b/tasks/agg-p27-n16-s06/instruction.md index 961985392d4b99bbc35d52871fb6450061a34bb5..c98bd62598f64ffcd1b51c3b31ced8e3cda7460c 100644 --- a/tasks/agg-p27-n16-s06/instruction.md +++ b/tasks/agg-p27-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s06/tests/test.sh b/tasks/agg-p27-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s06/tests/test.sh +++ b/tasks/agg-p27-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s07/instruction.md b/tasks/agg-p27-n16-s07/instruction.md index c83294206c6f7c5e973e8c218e0400911f653718..eef9c3edc8c0ed8aa6993d11f969e7bfdcc9dd6e 100644 --- a/tasks/agg-p27-n16-s07/instruction.md +++ b/tasks/agg-p27-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s07/tests/test.sh b/tasks/agg-p27-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s07/tests/test.sh +++ b/tasks/agg-p27-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s08/instruction.md b/tasks/agg-p27-n16-s08/instruction.md index b591b84320df9e123e22bd4301725691d49ea0a1..7f4d0ff076a0dba3c67021ed8791edf69a2b7c7b 100644 --- a/tasks/agg-p27-n16-s08/instruction.md +++ b/tasks/agg-p27-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s08/tests/test.sh b/tasks/agg-p27-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s08/tests/test.sh +++ b/tasks/agg-p27-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s09/instruction.md b/tasks/agg-p27-n16-s09/instruction.md index 9e673d50df3d0049f8ebbc5f08e69f16f929b38f..f17a373aff362de5ccbc3d2752a0dc99bf30605b 100644 --- a/tasks/agg-p27-n16-s09/instruction.md +++ b/tasks/agg-p27-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s09/tests/test.sh b/tasks/agg-p27-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s09/tests/test.sh +++ b/tasks/agg-p27-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s10/instruction.md b/tasks/agg-p27-n16-s10/instruction.md index c06c0812a7b7ea5a0caff9ffd07ddd76bc328ac2..769741a0d886c36eda905f6aea67cd579968498f 100644 --- a/tasks/agg-p27-n16-s10/instruction.md +++ b/tasks/agg-p27-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s10/tests/test.sh b/tasks/agg-p27-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s10/tests/test.sh +++ b/tasks/agg-p27-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s11/instruction.md b/tasks/agg-p27-n16-s11/instruction.md index 0d9b54e563f9bb163b48be34eb84abe311c00e06..ceda32fde53a1c10e904f97ed076f49abdf1f3a5 100644 --- a/tasks/agg-p27-n16-s11/instruction.md +++ b/tasks/agg-p27-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s11/tests/test.sh b/tasks/agg-p27-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s11/tests/test.sh +++ b/tasks/agg-p27-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s12/instruction.md b/tasks/agg-p27-n16-s12/instruction.md index f197f79da6e4638891b46f2053909c167ec13c32..856f7627093ea9ba708f7c4461f757925253fef9 100644 --- a/tasks/agg-p27-n16-s12/instruction.md +++ b/tasks/agg-p27-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s12/tests/test.sh b/tasks/agg-p27-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s12/tests/test.sh +++ b/tasks/agg-p27-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s13/instruction.md b/tasks/agg-p27-n16-s13/instruction.md index 0d32baca836c92adef8d08189e020f30d37446a4..acf1e48e00457882cd30e3ee2f445009de15d69b 100644 --- a/tasks/agg-p27-n16-s13/instruction.md +++ b/tasks/agg-p27-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s13/tests/test.sh b/tasks/agg-p27-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s13/tests/test.sh +++ b/tasks/agg-p27-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s14/instruction.md b/tasks/agg-p27-n16-s14/instruction.md index 5c5d544b57ab574592871eba4a9cf1c900af41ae..fcbafd4a7228b70ba628c7a82d64679c3d4fad1c 100644 --- a/tasks/agg-p27-n16-s14/instruction.md +++ b/tasks/agg-p27-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s14/tests/test.sh b/tasks/agg-p27-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s14/tests/test.sh +++ b/tasks/agg-p27-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s15/instruction.md b/tasks/agg-p27-n16-s15/instruction.md index 7d5ca093d11da3b866f85566039dbc2ac3bc8c84..7fe87dfffe4ad85e98cdbb07e05a77bf8a912afc 100644 --- a/tasks/agg-p27-n16-s15/instruction.md +++ b/tasks/agg-p27-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s15/tests/test.sh b/tasks/agg-p27-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s15/tests/test.sh +++ b/tasks/agg-p27-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p27-n16-s16/instruction.md b/tasks/agg-p27-n16-s16/instruction.md index 783fbdc57d72bfcadc0344c5e85549aaa9f3efe7..2ea77ca8a72381d318a57abe0da7ab6c0330246a 100644 --- a/tasks/agg-p27-n16-s16/instruction.md +++ b/tasks/agg-p27-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p27-n16-s16/tests/test.sh b/tasks/agg-p27-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p27-n16-s16/tests/test.sh +++ b/tasks/agg-p27-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n01-s01/instruction.md b/tasks/agg-p28-n01-s01/instruction.md index ba6ac69a03b344639062c966c996eac37e80fe55..ce8324de155239dd7378f666a59ee8a4f4125a06 100644 --- a/tasks/agg-p28-n01-s01/instruction.md +++ b/tasks/agg-p28-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is fifty-eight. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p28-n01-s01/tests/test.sh b/tasks/agg-p28-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n01-s01/tests/test.sh +++ b/tasks/agg-p28-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n02-s01/instruction.md b/tasks/agg-p28-n02-s01/instruction.md index 11e00df7861e2892348fedeef53c1d7a0b8467cc..0ae5d1368ca745ace317b7742bd93bc84e0ab972 100644 --- a/tasks/agg-p28-n02-s01/instruction.md +++ b/tasks/agg-p28-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n02-s01/tests/test.sh b/tasks/agg-p28-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n02-s01/tests/test.sh +++ b/tasks/agg-p28-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n02-s02/instruction.md b/tasks/agg-p28-n02-s02/instruction.md index cb87db73d5bf4b2b31ccc1f58a80a87e4a213982..01dc6b51bcdb9a6d3ad1578e70885e475daa8043 100644 --- a/tasks/agg-p28-n02-s02/instruction.md +++ b/tasks/agg-p28-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n02-s02/tests/test.sh b/tasks/agg-p28-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n02-s02/tests/test.sh +++ b/tasks/agg-p28-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n04-s01/instruction.md b/tasks/agg-p28-n04-s01/instruction.md index 690776d613f6492564c14822c0e0ffdbc82c07c1..55f801ff1fc5bcfe0c80e18f5fb86a983b165c93 100644 --- a/tasks/agg-p28-n04-s01/instruction.md +++ b/tasks/agg-p28-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n04-s01/tests/test.sh b/tasks/agg-p28-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n04-s01/tests/test.sh +++ b/tasks/agg-p28-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n04-s02/instruction.md b/tasks/agg-p28-n04-s02/instruction.md index 2fdd036d16482b9a65a4c12fbd6caac1b69095a8..f08e560b5d0e23c56ad897635078a6f7f241dd05 100644 --- a/tasks/agg-p28-n04-s02/instruction.md +++ b/tasks/agg-p28-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n04-s02/tests/test.sh b/tasks/agg-p28-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n04-s02/tests/test.sh +++ b/tasks/agg-p28-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n04-s03/instruction.md b/tasks/agg-p28-n04-s03/instruction.md index ef36ba153f10efe5727ee31abce38b8dd6141aca..e95b7b28395f0be68043d868e45036c0708293fe 100644 --- a/tasks/agg-p28-n04-s03/instruction.md +++ b/tasks/agg-p28-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n04-s03/tests/test.sh b/tasks/agg-p28-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n04-s03/tests/test.sh +++ b/tasks/agg-p28-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n04-s04/instruction.md b/tasks/agg-p28-n04-s04/instruction.md index 5987a7d8fb0988b1c93d1e7275fa7711d0753afb..9063b014df5918d44cbad92da225d1206dee3d4d 100644 --- a/tasks/agg-p28-n04-s04/instruction.md +++ b/tasks/agg-p28-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n04-s04/tests/test.sh b/tasks/agg-p28-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n04-s04/tests/test.sh +++ b/tasks/agg-p28-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n06-s01/instruction.md b/tasks/agg-p28-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..136600b82428d2cc92ee8f9106e6332e504832eb --- /dev/null +++ b/tasks/agg-p28-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n06-s01/solution/solve.sh b/tasks/agg-p28-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd955ca732ec6ea9f5e4a1d08e53df6c0ee8d03a --- /dev/null +++ b/tasks/agg-p28-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 33, 38, 58, 67, 70]' > "$answer" diff --git a/tasks/agg-p28-n06-s01/task.toml b/tasks/agg-p28-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f5c96590eedfee78cf07538971f21ef06ce72dbe --- /dev/null +++ b/tasks/agg-p28-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n06-s01/tests/expected.json b/tasks/agg-p28-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..9bb9ddc39effb0c695516403fbfb63233f7d1abb --- /dev/null +++ b/tasks/agg-p28-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[12, 33, 38, 58, 67, 70] diff --git a/tasks/agg-p28-n06-s01/tests/test.sh b/tasks/agg-p28-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n06-s02/instruction.md b/tasks/agg-p28-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a0391fdc0975cceaca695a17de8d8a49acb4f08d --- /dev/null +++ b/tasks/agg-p28-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n06-s02/solution/solve.sh b/tasks/agg-p28-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd955ca732ec6ea9f5e4a1d08e53df6c0ee8d03a --- /dev/null +++ b/tasks/agg-p28-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 33, 38, 58, 67, 70]' > "$answer" diff --git a/tasks/agg-p28-n06-s02/task.toml b/tasks/agg-p28-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..471f9313607498099646e16986becbaa82f87fcb --- /dev/null +++ b/tasks/agg-p28-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n06-s02/tests/expected.json b/tasks/agg-p28-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..9bb9ddc39effb0c695516403fbfb63233f7d1abb --- /dev/null +++ b/tasks/agg-p28-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[12, 33, 38, 58, 67, 70] diff --git a/tasks/agg-p28-n06-s02/tests/test.sh b/tasks/agg-p28-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n06-s03/instruction.md b/tasks/agg-p28-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8cccd6bb4840d122bc891dcbcfc377ca88a66413 --- /dev/null +++ b/tasks/agg-p28-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-seven. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n06-s03/solution/solve.sh b/tasks/agg-p28-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd955ca732ec6ea9f5e4a1d08e53df6c0ee8d03a --- /dev/null +++ b/tasks/agg-p28-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 33, 38, 58, 67, 70]' > "$answer" diff --git a/tasks/agg-p28-n06-s03/task.toml b/tasks/agg-p28-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e59bea2b44c4ecc676d7686c1026dd9bbc97c7a1 --- /dev/null +++ b/tasks/agg-p28-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n06-s03/tests/expected.json b/tasks/agg-p28-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..9bb9ddc39effb0c695516403fbfb63233f7d1abb --- /dev/null +++ b/tasks/agg-p28-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[12, 33, 38, 58, 67, 70] diff --git a/tasks/agg-p28-n06-s03/tests/test.sh b/tasks/agg-p28-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n06-s04/instruction.md b/tasks/agg-p28-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f53b932eb96c7fa17de711ae8bf9be9f84d04c56 --- /dev/null +++ b/tasks/agg-p28-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n06-s04/solution/solve.sh b/tasks/agg-p28-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd955ca732ec6ea9f5e4a1d08e53df6c0ee8d03a --- /dev/null +++ b/tasks/agg-p28-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 33, 38, 58, 67, 70]' > "$answer" diff --git a/tasks/agg-p28-n06-s04/task.toml b/tasks/agg-p28-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..53cf224ac2be54517bb43c48c4a7f4b8bce58e28 --- /dev/null +++ b/tasks/agg-p28-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n06-s04/tests/expected.json b/tasks/agg-p28-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..9bb9ddc39effb0c695516403fbfb63233f7d1abb --- /dev/null +++ b/tasks/agg-p28-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[12, 33, 38, 58, 67, 70] diff --git a/tasks/agg-p28-n06-s04/tests/test.sh b/tasks/agg-p28-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n06-s05/instruction.md b/tasks/agg-p28-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b81a4d1b6c939af2f3d24f5e34fcceb0afa2bed5 --- /dev/null +++ b/tasks/agg-p28-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n06-s05/solution/solve.sh b/tasks/agg-p28-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd955ca732ec6ea9f5e4a1d08e53df6c0ee8d03a --- /dev/null +++ b/tasks/agg-p28-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 33, 38, 58, 67, 70]' > "$answer" diff --git a/tasks/agg-p28-n06-s05/task.toml b/tasks/agg-p28-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..57088269b3035e3b7a8910639b6620b629a1cba5 --- /dev/null +++ b/tasks/agg-p28-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n06-s05/tests/expected.json b/tasks/agg-p28-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..9bb9ddc39effb0c695516403fbfb63233f7d1abb --- /dev/null +++ b/tasks/agg-p28-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[12, 33, 38, 58, 67, 70] diff --git a/tasks/agg-p28-n06-s05/tests/test.sh b/tasks/agg-p28-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n06-s06/instruction.md b/tasks/agg-p28-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..64ac36448e2dbf7956db9f18492ddc2ab2e6610f --- /dev/null +++ b/tasks/agg-p28-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twelve. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n06-s06/solution/solve.sh b/tasks/agg-p28-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd955ca732ec6ea9f5e4a1d08e53df6c0ee8d03a --- /dev/null +++ b/tasks/agg-p28-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 33, 38, 58, 67, 70]' > "$answer" diff --git a/tasks/agg-p28-n06-s06/task.toml b/tasks/agg-p28-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b86077ad6a34113ce26f4a57094d922d09c046b7 --- /dev/null +++ b/tasks/agg-p28-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n06-s06/tests/expected.json b/tasks/agg-p28-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..9bb9ddc39effb0c695516403fbfb63233f7d1abb --- /dev/null +++ b/tasks/agg-p28-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[12, 33, 38, 58, 67, 70] diff --git a/tasks/agg-p28-n06-s06/tests/test.sh b/tasks/agg-p28-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n08-s01/instruction.md b/tasks/agg-p28-n08-s01/instruction.md index e62126a64149a24e7278e73a216c4b232e5a78b2..b71e2424ef5ce0937a35b4ebd2df423d133331cc 100644 --- a/tasks/agg-p28-n08-s01/instruction.md +++ b/tasks/agg-p28-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n08-s01/tests/test.sh b/tasks/agg-p28-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n08-s01/tests/test.sh +++ b/tasks/agg-p28-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n08-s02/instruction.md b/tasks/agg-p28-n08-s02/instruction.md index e21142b6e0df055b0e0bb6899f7eab5e6cc92fb4..afc952163a35fd3b6411c5d3e8199ea1d02f0544 100644 --- a/tasks/agg-p28-n08-s02/instruction.md +++ b/tasks/agg-p28-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n08-s02/tests/test.sh b/tasks/agg-p28-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n08-s02/tests/test.sh +++ b/tasks/agg-p28-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n08-s03/instruction.md b/tasks/agg-p28-n08-s03/instruction.md index c462ac9ca802050bd457b3cfba5d7a79b08da47d..8e802c76e52f1cd50ead7780f6b45504832c0a85 100644 --- a/tasks/agg-p28-n08-s03/instruction.md +++ b/tasks/agg-p28-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n08-s03/tests/test.sh b/tasks/agg-p28-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n08-s03/tests/test.sh +++ b/tasks/agg-p28-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n08-s04/instruction.md b/tasks/agg-p28-n08-s04/instruction.md index 0b145aa6f7984df45e66ec21f6a52c77dba2a1a6..ac14e6f763f8a61d767f33044d08ee95695fffcb 100644 --- a/tasks/agg-p28-n08-s04/instruction.md +++ b/tasks/agg-p28-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n08-s04/tests/test.sh b/tasks/agg-p28-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n08-s04/tests/test.sh +++ b/tasks/agg-p28-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n08-s05/instruction.md b/tasks/agg-p28-n08-s05/instruction.md index 03c94df8689da4f5b0401f4f3decef651eb9aee0..f59205650a10f9897e7be3c7465c8741b50c1c70 100644 --- a/tasks/agg-p28-n08-s05/instruction.md +++ b/tasks/agg-p28-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n08-s05/tests/test.sh b/tasks/agg-p28-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n08-s05/tests/test.sh +++ b/tasks/agg-p28-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n08-s06/instruction.md b/tasks/agg-p28-n08-s06/instruction.md index a94aeebf9e8286b30025fd530a9c33d5587c12ad..cf4266e28b21bdd50d23c3824ddaec94fe1bd8d5 100644 --- a/tasks/agg-p28-n08-s06/instruction.md +++ b/tasks/agg-p28-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n08-s06/tests/test.sh b/tasks/agg-p28-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n08-s06/tests/test.sh +++ b/tasks/agg-p28-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n08-s07/instruction.md b/tasks/agg-p28-n08-s07/instruction.md index fcb1550a490d72b760744b8ed931194f57a75250..c13b7d01671e36bec9b4b71fd7c0dc1d979486ec 100644 --- a/tasks/agg-p28-n08-s07/instruction.md +++ b/tasks/agg-p28-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n08-s07/tests/test.sh b/tasks/agg-p28-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n08-s07/tests/test.sh +++ b/tasks/agg-p28-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n08-s08/instruction.md b/tasks/agg-p28-n08-s08/instruction.md index 183578f4cd202fb917e5afc71715cf45b333a146..7badc85237e412bda6e80a246cad7fb5790e34e3 100644 --- a/tasks/agg-p28-n08-s08/instruction.md +++ b/tasks/agg-p28-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n08-s08/tests/test.sh b/tasks/agg-p28-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n08-s08/tests/test.sh +++ b/tasks/agg-p28-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n12-s01/instruction.md b/tasks/agg-p28-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8b047c78be8ec74c45258c089b61fd8c92d01be1 --- /dev/null +++ b/tasks/agg-p28-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n12-s01/solution/solve.sh b/tasks/agg-p28-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..320aa4d3301b7dfadbf45a2daf44a207260d1d84 --- /dev/null +++ b/tasks/agg-p28-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94]' > "$answer" diff --git a/tasks/agg-p28-n12-s01/task.toml b/tasks/agg-p28-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0ce6d28502cb6b3cd6ead2fc0d8b70cad7b97a9e --- /dev/null +++ b/tasks/agg-p28-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n12-s01/tests/expected.json b/tasks/agg-p28-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3de7424395bc37e353efbe620ddd2721d6d91528 --- /dev/null +++ b/tasks/agg-p28-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94] diff --git a/tasks/agg-p28-n12-s01/tests/test.sh b/tasks/agg-p28-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n12-s02/instruction.md b/tasks/agg-p28-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bb40c13254db093b772375b0bb70c64bc0b6f8b8 --- /dev/null +++ b/tasks/agg-p28-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n12-s02/solution/solve.sh b/tasks/agg-p28-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..320aa4d3301b7dfadbf45a2daf44a207260d1d84 --- /dev/null +++ b/tasks/agg-p28-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94]' > "$answer" diff --git a/tasks/agg-p28-n12-s02/task.toml b/tasks/agg-p28-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a759a25305dcc768e71b167eaa066c8bb8f74c37 --- /dev/null +++ b/tasks/agg-p28-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n12-s02/tests/expected.json b/tasks/agg-p28-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3de7424395bc37e353efbe620ddd2721d6d91528 --- /dev/null +++ b/tasks/agg-p28-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94] diff --git a/tasks/agg-p28-n12-s02/tests/test.sh b/tasks/agg-p28-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n12-s03/instruction.md b/tasks/agg-p28-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ac0fb3589d74cb9ec090d7919df303360b87a4cd --- /dev/null +++ b/tasks/agg-p28-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n12-s03/solution/solve.sh b/tasks/agg-p28-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..320aa4d3301b7dfadbf45a2daf44a207260d1d84 --- /dev/null +++ b/tasks/agg-p28-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94]' > "$answer" diff --git a/tasks/agg-p28-n12-s03/task.toml b/tasks/agg-p28-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8e570b85013b559fd55a06f48ed6ffc578ad6137 --- /dev/null +++ b/tasks/agg-p28-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n12-s03/tests/expected.json b/tasks/agg-p28-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3de7424395bc37e353efbe620ddd2721d6d91528 --- /dev/null +++ b/tasks/agg-p28-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94] diff --git a/tasks/agg-p28-n12-s03/tests/test.sh b/tasks/agg-p28-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n12-s04/instruction.md b/tasks/agg-p28-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..addd22697de677a2c2079817ecf992d0d4b0b0ff --- /dev/null +++ b/tasks/agg-p28-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n12-s04/solution/solve.sh b/tasks/agg-p28-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..320aa4d3301b7dfadbf45a2daf44a207260d1d84 --- /dev/null +++ b/tasks/agg-p28-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94]' > "$answer" diff --git a/tasks/agg-p28-n12-s04/task.toml b/tasks/agg-p28-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f53b89d7f808dfe4067c35ad3003dcbc596b584c --- /dev/null +++ b/tasks/agg-p28-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n12-s04/tests/expected.json b/tasks/agg-p28-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3de7424395bc37e353efbe620ddd2721d6d91528 --- /dev/null +++ b/tasks/agg-p28-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94] diff --git a/tasks/agg-p28-n12-s04/tests/test.sh b/tasks/agg-p28-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n12-s05/instruction.md b/tasks/agg-p28-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ac4ab97ac5016f85469b1949304d6955bc5c5cdc --- /dev/null +++ b/tasks/agg-p28-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n12-s05/solution/solve.sh b/tasks/agg-p28-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..320aa4d3301b7dfadbf45a2daf44a207260d1d84 --- /dev/null +++ b/tasks/agg-p28-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94]' > "$answer" diff --git a/tasks/agg-p28-n12-s05/task.toml b/tasks/agg-p28-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..edd9da66084ba539db91e7c4c569f4a3780ee3e4 --- /dev/null +++ b/tasks/agg-p28-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n12-s05/tests/expected.json b/tasks/agg-p28-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3de7424395bc37e353efbe620ddd2721d6d91528 --- /dev/null +++ b/tasks/agg-p28-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94] diff --git a/tasks/agg-p28-n12-s05/tests/test.sh b/tasks/agg-p28-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n12-s06/instruction.md b/tasks/agg-p28-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cbefd6b3434fac66c24e06d94b9c3c278b95dbfb --- /dev/null +++ b/tasks/agg-p28-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twelve. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n12-s06/solution/solve.sh b/tasks/agg-p28-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..320aa4d3301b7dfadbf45a2daf44a207260d1d84 --- /dev/null +++ b/tasks/agg-p28-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94]' > "$answer" diff --git a/tasks/agg-p28-n12-s06/task.toml b/tasks/agg-p28-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e1ae2fd6e3d355ff701368448eba52d74575d181 --- /dev/null +++ b/tasks/agg-p28-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n12-s06/tests/expected.json b/tasks/agg-p28-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3de7424395bc37e353efbe620ddd2721d6d91528 --- /dev/null +++ b/tasks/agg-p28-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94] diff --git a/tasks/agg-p28-n12-s06/tests/test.sh b/tasks/agg-p28-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n12-s07/instruction.md b/tasks/agg-p28-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f4b49efc3c821e0d716e0443cac99bdb036d4e81 --- /dev/null +++ b/tasks/agg-p28-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n12-s07/solution/solve.sh b/tasks/agg-p28-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..320aa4d3301b7dfadbf45a2daf44a207260d1d84 --- /dev/null +++ b/tasks/agg-p28-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94]' > "$answer" diff --git a/tasks/agg-p28-n12-s07/task.toml b/tasks/agg-p28-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ede13038c3741618681685225e2d9d1d72a10a74 --- /dev/null +++ b/tasks/agg-p28-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n12-s07/tests/expected.json b/tasks/agg-p28-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3de7424395bc37e353efbe620ddd2721d6d91528 --- /dev/null +++ b/tasks/agg-p28-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94] diff --git a/tasks/agg-p28-n12-s07/tests/test.sh b/tasks/agg-p28-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n12-s08/instruction.md b/tasks/agg-p28-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5c22331dc1a92d7ed5e6c9f916d7bff8ffb1e839 --- /dev/null +++ b/tasks/agg-p28-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n12-s08/solution/solve.sh b/tasks/agg-p28-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..320aa4d3301b7dfadbf45a2daf44a207260d1d84 --- /dev/null +++ b/tasks/agg-p28-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94]' > "$answer" diff --git a/tasks/agg-p28-n12-s08/task.toml b/tasks/agg-p28-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6ba24a215448978b6bbcf7aa0b9f32b363856229 --- /dev/null +++ b/tasks/agg-p28-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n12-s08/tests/expected.json b/tasks/agg-p28-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3de7424395bc37e353efbe620ddd2721d6d91528 --- /dev/null +++ b/tasks/agg-p28-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94] diff --git a/tasks/agg-p28-n12-s08/tests/test.sh b/tasks/agg-p28-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n12-s09/instruction.md b/tasks/agg-p28-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2d59f1157c1824f7f2e06071771dcd5b3a427585 --- /dev/null +++ b/tasks/agg-p28-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n12-s09/solution/solve.sh b/tasks/agg-p28-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..320aa4d3301b7dfadbf45a2daf44a207260d1d84 --- /dev/null +++ b/tasks/agg-p28-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94]' > "$answer" diff --git a/tasks/agg-p28-n12-s09/task.toml b/tasks/agg-p28-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1cd090debddef2bd494b10828cb75c5ff73eac4c --- /dev/null +++ b/tasks/agg-p28-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n12-s09/tests/expected.json b/tasks/agg-p28-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3de7424395bc37e353efbe620ddd2721d6d91528 --- /dev/null +++ b/tasks/agg-p28-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94] diff --git a/tasks/agg-p28-n12-s09/tests/test.sh b/tasks/agg-p28-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n12-s10/instruction.md b/tasks/agg-p28-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..710a88fca3c54632b531e8326d63c5a443adad46 --- /dev/null +++ b/tasks/agg-p28-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n12-s10/solution/solve.sh b/tasks/agg-p28-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..320aa4d3301b7dfadbf45a2daf44a207260d1d84 --- /dev/null +++ b/tasks/agg-p28-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94]' > "$answer" diff --git a/tasks/agg-p28-n12-s10/task.toml b/tasks/agg-p28-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d5bdf6184243f10fd552ce672996ab394ecd6689 --- /dev/null +++ b/tasks/agg-p28-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n12-s10/tests/expected.json b/tasks/agg-p28-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3de7424395bc37e353efbe620ddd2721d6d91528 --- /dev/null +++ b/tasks/agg-p28-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94] diff --git a/tasks/agg-p28-n12-s10/tests/test.sh b/tasks/agg-p28-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n12-s11/instruction.md b/tasks/agg-p28-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..619b52b72dd0e0fb5294f24176b256347b8b4527 --- /dev/null +++ b/tasks/agg-p28-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n12-s11/solution/solve.sh b/tasks/agg-p28-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..320aa4d3301b7dfadbf45a2daf44a207260d1d84 --- /dev/null +++ b/tasks/agg-p28-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94]' > "$answer" diff --git a/tasks/agg-p28-n12-s11/task.toml b/tasks/agg-p28-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8f65acd85b389b28a9118796d471823089a03c64 --- /dev/null +++ b/tasks/agg-p28-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n12-s11/tests/expected.json b/tasks/agg-p28-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3de7424395bc37e353efbe620ddd2721d6d91528 --- /dev/null +++ b/tasks/agg-p28-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94] diff --git a/tasks/agg-p28-n12-s11/tests/test.sh b/tasks/agg-p28-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n12-s12/instruction.md b/tasks/agg-p28-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7ff657bb74acf9250e227987f479f3d6c5ef2c59 --- /dev/null +++ b/tasks/agg-p28-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n12-s12/solution/solve.sh b/tasks/agg-p28-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..320aa4d3301b7dfadbf45a2daf44a207260d1d84 --- /dev/null +++ b/tasks/agg-p28-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94]' > "$answer" diff --git a/tasks/agg-p28-n12-s12/task.toml b/tasks/agg-p28-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cf17a575ce55e8ba3d739ff65c54dec77169fb04 --- /dev/null +++ b/tasks/agg-p28-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p28-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 28 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p28-n12-s12/tests/expected.json b/tasks/agg-p28-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..3de7424395bc37e353efbe620ddd2721d6d91528 --- /dev/null +++ b/tasks/agg-p28-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[7, 12, 24, 33, 38, 53, 58, 67, 70, 77, 93, 94] diff --git a/tasks/agg-p28-n12-s12/tests/test.sh b/tasks/agg-p28-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p28-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p28-n16-s01/instruction.md b/tasks/agg-p28-n16-s01/instruction.md index e5c784e3be1e3c1c8c8931ac55ae2345c1d7e341..0132dbcb468155a843c8c2b7a4a9e6ca2be0c499 100644 --- a/tasks/agg-p28-n16-s01/instruction.md +++ b/tasks/agg-p28-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s01/tests/test.sh b/tasks/agg-p28-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s01/tests/test.sh +++ b/tasks/agg-p28-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s02/instruction.md b/tasks/agg-p28-n16-s02/instruction.md index d398ea97722601a49a457530f502678c0a1433cf..e1c1f7d3b01724d8dea774465c5f5d8397b1d161 100644 --- a/tasks/agg-p28-n16-s02/instruction.md +++ b/tasks/agg-p28-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s02/tests/test.sh b/tasks/agg-p28-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s02/tests/test.sh +++ b/tasks/agg-p28-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s03/instruction.md b/tasks/agg-p28-n16-s03/instruction.md index cebfaeb748131e1409dea8040dd71bd8744f230b..f855e374529122b9a74995c685bdc0845b660076 100644 --- a/tasks/agg-p28-n16-s03/instruction.md +++ b/tasks/agg-p28-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s03/tests/test.sh b/tasks/agg-p28-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s03/tests/test.sh +++ b/tasks/agg-p28-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s04/instruction.md b/tasks/agg-p28-n16-s04/instruction.md index 93b42da3c5ae14f9371e8643b81073fb0536e08a..366c2719a35a34f7a33d98415916d2080eb2b7e2 100644 --- a/tasks/agg-p28-n16-s04/instruction.md +++ b/tasks/agg-p28-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s04/tests/test.sh b/tasks/agg-p28-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s04/tests/test.sh +++ b/tasks/agg-p28-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s05/instruction.md b/tasks/agg-p28-n16-s05/instruction.md index d92b3c67aa869a2b7ccb0b74ca78af94faae0b02..671a8ab2cae28823934c021dcf645fc4038d0570 100644 --- a/tasks/agg-p28-n16-s05/instruction.md +++ b/tasks/agg-p28-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s05/tests/test.sh b/tasks/agg-p28-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s05/tests/test.sh +++ b/tasks/agg-p28-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s06/instruction.md b/tasks/agg-p28-n16-s06/instruction.md index 0d9b54e563f9bb163b48be34eb84abe311c00e06..ceda32fde53a1c10e904f97ed076f49abdf1f3a5 100644 --- a/tasks/agg-p28-n16-s06/instruction.md +++ b/tasks/agg-p28-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s06/tests/test.sh b/tasks/agg-p28-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s06/tests/test.sh +++ b/tasks/agg-p28-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s07/instruction.md b/tasks/agg-p28-n16-s07/instruction.md index 3a10e21a080f18532e8e18935bc65496e13588a2..3b81386b59fb88e5b2c11fc6768f76e2b16d0fe9 100644 --- a/tasks/agg-p28-n16-s07/instruction.md +++ b/tasks/agg-p28-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s07/tests/test.sh b/tasks/agg-p28-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s07/tests/test.sh +++ b/tasks/agg-p28-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s08/instruction.md b/tasks/agg-p28-n16-s08/instruction.md index 5a931caf2f59950e949680657e57e512d16ee533..e73e804c423ed11a4e1c56759956f246bcd22e10 100644 --- a/tasks/agg-p28-n16-s08/instruction.md +++ b/tasks/agg-p28-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s08/tests/test.sh b/tasks/agg-p28-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s08/tests/test.sh +++ b/tasks/agg-p28-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s09/instruction.md b/tasks/agg-p28-n16-s09/instruction.md index 5c5d544b57ab574592871eba4a9cf1c900af41ae..fcbafd4a7228b70ba628c7a82d64679c3d4fad1c 100644 --- a/tasks/agg-p28-n16-s09/instruction.md +++ b/tasks/agg-p28-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s09/tests/test.sh b/tasks/agg-p28-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s09/tests/test.sh +++ b/tasks/agg-p28-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s10/instruction.md b/tasks/agg-p28-n16-s10/instruction.md index 951d8309ecd3f9fbcea5726f506c658fa51c95fe..66045864ad601fbe1194d5fcde0a3bfc9fdbc25b 100644 --- a/tasks/agg-p28-n16-s10/instruction.md +++ b/tasks/agg-p28-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s10/tests/test.sh b/tasks/agg-p28-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s10/tests/test.sh +++ b/tasks/agg-p28-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s11/instruction.md b/tasks/agg-p28-n16-s11/instruction.md index d019999eecd81b0d102088ffd8dc6702e314773f..0800edc3b640ede26ab3978765dad5c40d1446ad 100644 --- a/tasks/agg-p28-n16-s11/instruction.md +++ b/tasks/agg-p28-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s11/tests/test.sh b/tasks/agg-p28-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s11/tests/test.sh +++ b/tasks/agg-p28-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s12/instruction.md b/tasks/agg-p28-n16-s12/instruction.md index e291fbc977a39d7840cab85af303fe0db4b788af..fd4749e73869d5bc6d1d79fb31331e73e6166413 100644 --- a/tasks/agg-p28-n16-s12/instruction.md +++ b/tasks/agg-p28-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s12/tests/test.sh b/tasks/agg-p28-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s12/tests/test.sh +++ b/tasks/agg-p28-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s13/instruction.md b/tasks/agg-p28-n16-s13/instruction.md index 99a7f97eb2774bf91fcf02fc9e18c71f2c746d9d..b0c86232070beace6f6b66df51114731c8869870 100644 --- a/tasks/agg-p28-n16-s13/instruction.md +++ b/tasks/agg-p28-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s13/tests/test.sh b/tasks/agg-p28-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s13/tests/test.sh +++ b/tasks/agg-p28-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s14/instruction.md b/tasks/agg-p28-n16-s14/instruction.md index ff35f53eda015951f8078ff0751a783f65818958..e3de5217dbfb10d0002092b53e5f480dfe257ac6 100644 --- a/tasks/agg-p28-n16-s14/instruction.md +++ b/tasks/agg-p28-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s14/tests/test.sh b/tasks/agg-p28-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s14/tests/test.sh +++ b/tasks/agg-p28-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s15/instruction.md b/tasks/agg-p28-n16-s15/instruction.md index 7cf63660731cfb255f4030930d1fa31a717d902f..6dab277b2fabfee8f34045a8f6fb47ac3384734d 100644 --- a/tasks/agg-p28-n16-s15/instruction.md +++ b/tasks/agg-p28-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s15/tests/test.sh b/tasks/agg-p28-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s15/tests/test.sh +++ b/tasks/agg-p28-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p28-n16-s16/instruction.md b/tasks/agg-p28-n16-s16/instruction.md index eec0889f35f181e3d5ee370338313f8afc894fe8..741d5c897d7dc6413c1bb96a8b00478c60c908ba 100644 --- a/tasks/agg-p28-n16-s16/instruction.md +++ b/tasks/agg-p28-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p28-n16-s16/tests/test.sh b/tasks/agg-p28-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p28-n16-s16/tests/test.sh +++ b/tasks/agg-p28-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n01-s01/instruction.md b/tasks/agg-p29-n01-s01/instruction.md index fe3fd34293c024555dd5cbf7890e2c79950341f0..1b284bcaf5607bb91d1008b0833d979670acf268 100644 --- a/tasks/agg-p29-n01-s01/instruction.md +++ b/tasks/agg-p29-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is twenty-three. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p29-n01-s01/tests/test.sh b/tasks/agg-p29-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n01-s01/tests/test.sh +++ b/tasks/agg-p29-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n02-s01/instruction.md b/tasks/agg-p29-n02-s01/instruction.md index c0bd303417274bf1a0c037286116fba257c99c87..0a79a1ed43ac78a99007d72b4caa104823ac0512 100644 --- a/tasks/agg-p29-n02-s01/instruction.md +++ b/tasks/agg-p29-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n02-s01/tests/test.sh b/tasks/agg-p29-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n02-s01/tests/test.sh +++ b/tasks/agg-p29-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n02-s02/instruction.md b/tasks/agg-p29-n02-s02/instruction.md index b74bfd8401dd040791909d6cf84388bf2c5d8158..bcb39746e03d029ee957c0404ca62fcdeeeeb54b 100644 --- a/tasks/agg-p29-n02-s02/instruction.md +++ b/tasks/agg-p29-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n02-s02/tests/test.sh b/tasks/agg-p29-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n02-s02/tests/test.sh +++ b/tasks/agg-p29-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n04-s01/instruction.md b/tasks/agg-p29-n04-s01/instruction.md index 68b7508bd8f70bb90517cd8b23e9d1db9ea72eca..d96933241d61e955fa8544e894ba163c34a7af6e 100644 --- a/tasks/agg-p29-n04-s01/instruction.md +++ b/tasks/agg-p29-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n04-s01/tests/test.sh b/tasks/agg-p29-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n04-s01/tests/test.sh +++ b/tasks/agg-p29-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n04-s02/instruction.md b/tasks/agg-p29-n04-s02/instruction.md index 9f0f47428da9534522c799558543c5d8ccdc8480..44b8bbe3ba28ccce8bc63a48a88c1f664b898955 100644 --- a/tasks/agg-p29-n04-s02/instruction.md +++ b/tasks/agg-p29-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n04-s02/tests/test.sh b/tasks/agg-p29-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n04-s02/tests/test.sh +++ b/tasks/agg-p29-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n04-s03/instruction.md b/tasks/agg-p29-n04-s03/instruction.md index 57844953b25edf19db718990c35fe23e43f95f7a..1db807b3251e3960507b5ac241bf4434dd57e761 100644 --- a/tasks/agg-p29-n04-s03/instruction.md +++ b/tasks/agg-p29-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n04-s03/tests/test.sh b/tasks/agg-p29-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n04-s03/tests/test.sh +++ b/tasks/agg-p29-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n04-s04/instruction.md b/tasks/agg-p29-n04-s04/instruction.md index 680b87be1a6a736859b11707e6c2ffe2157f5d4c..53cd2d9001f1713a4d940bef539b9685cb756750 100644 --- a/tasks/agg-p29-n04-s04/instruction.md +++ b/tasks/agg-p29-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n04-s04/tests/test.sh b/tasks/agg-p29-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n04-s04/tests/test.sh +++ b/tasks/agg-p29-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n06-s01/instruction.md b/tasks/agg-p29-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..db46a85781c5f4b05255f5b663546479ae052559 --- /dev/null +++ b/tasks/agg-p29-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n06-s01/solution/solve.sh b/tasks/agg-p29-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5f08acee42004add64a2cbcb6150df23577d77e7 --- /dev/null +++ b/tasks/agg-p29-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[22, 23, 45, 82, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n06-s01/task.toml b/tasks/agg-p29-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..44f46d6fec053006827ad2295321c40da47035b1 --- /dev/null +++ b/tasks/agg-p29-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n06-s01/tests/expected.json b/tasks/agg-p29-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..34dacf80ed92f1c21af803000423fafef5000261 --- /dev/null +++ b/tasks/agg-p29-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[22, 23, 45, 82, 89, 92] diff --git a/tasks/agg-p29-n06-s01/tests/test.sh b/tasks/agg-p29-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n06-s02/instruction.md b/tasks/agg-p29-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..786d1fe5ab83a56dbefe27ab387d283f9bb9cdfa --- /dev/null +++ b/tasks/agg-p29-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n06-s02/solution/solve.sh b/tasks/agg-p29-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5f08acee42004add64a2cbcb6150df23577d77e7 --- /dev/null +++ b/tasks/agg-p29-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[22, 23, 45, 82, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n06-s02/task.toml b/tasks/agg-p29-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7f04f8fc3d9be350935824fc57b43d39b9db1d9f --- /dev/null +++ b/tasks/agg-p29-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n06-s02/tests/expected.json b/tasks/agg-p29-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..34dacf80ed92f1c21af803000423fafef5000261 --- /dev/null +++ b/tasks/agg-p29-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[22, 23, 45, 82, 89, 92] diff --git a/tasks/agg-p29-n06-s02/tests/test.sh b/tasks/agg-p29-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n06-s03/instruction.md b/tasks/agg-p29-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fb49187f26e2368e600222d3d58320c4d2c80ff9 --- /dev/null +++ b/tasks/agg-p29-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n06-s03/solution/solve.sh b/tasks/agg-p29-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5f08acee42004add64a2cbcb6150df23577d77e7 --- /dev/null +++ b/tasks/agg-p29-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[22, 23, 45, 82, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n06-s03/task.toml b/tasks/agg-p29-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3c58054cba7e1dff9f63eb101940af5a97bc9b93 --- /dev/null +++ b/tasks/agg-p29-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n06-s03/tests/expected.json b/tasks/agg-p29-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..34dacf80ed92f1c21af803000423fafef5000261 --- /dev/null +++ b/tasks/agg-p29-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[22, 23, 45, 82, 89, 92] diff --git a/tasks/agg-p29-n06-s03/tests/test.sh b/tasks/agg-p29-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n06-s04/instruction.md b/tasks/agg-p29-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d8bab66eb3d5058caae65c9939daace434a1e497 --- /dev/null +++ b/tasks/agg-p29-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n06-s04/solution/solve.sh b/tasks/agg-p29-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5f08acee42004add64a2cbcb6150df23577d77e7 --- /dev/null +++ b/tasks/agg-p29-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[22, 23, 45, 82, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n06-s04/task.toml b/tasks/agg-p29-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2307f17b7eb8f15c70b0cfefca90761ccb77e6a9 --- /dev/null +++ b/tasks/agg-p29-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n06-s04/tests/expected.json b/tasks/agg-p29-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..34dacf80ed92f1c21af803000423fafef5000261 --- /dev/null +++ b/tasks/agg-p29-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[22, 23, 45, 82, 89, 92] diff --git a/tasks/agg-p29-n06-s04/tests/test.sh b/tasks/agg-p29-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n06-s05/instruction.md b/tasks/agg-p29-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..3e1db2c668a1429fe99e57b7aa4909b11c27a8ea --- /dev/null +++ b/tasks/agg-p29-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n06-s05/solution/solve.sh b/tasks/agg-p29-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5f08acee42004add64a2cbcb6150df23577d77e7 --- /dev/null +++ b/tasks/agg-p29-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[22, 23, 45, 82, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n06-s05/task.toml b/tasks/agg-p29-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5acc9f0305c64405139aadc469b3409240ef4697 --- /dev/null +++ b/tasks/agg-p29-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n06-s05/tests/expected.json b/tasks/agg-p29-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..34dacf80ed92f1c21af803000423fafef5000261 --- /dev/null +++ b/tasks/agg-p29-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[22, 23, 45, 82, 89, 92] diff --git a/tasks/agg-p29-n06-s05/tests/test.sh b/tasks/agg-p29-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n06-s06/instruction.md b/tasks/agg-p29-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2c7e63e09fb5a7d331c35a5363d54211ebfc3f1e --- /dev/null +++ b/tasks/agg-p29-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-nine. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n06-s06/solution/solve.sh b/tasks/agg-p29-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5f08acee42004add64a2cbcb6150df23577d77e7 --- /dev/null +++ b/tasks/agg-p29-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[22, 23, 45, 82, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n06-s06/task.toml b/tasks/agg-p29-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a97df47865c17bfe30fc07713add77b94b738cd0 --- /dev/null +++ b/tasks/agg-p29-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n06-s06/tests/expected.json b/tasks/agg-p29-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..34dacf80ed92f1c21af803000423fafef5000261 --- /dev/null +++ b/tasks/agg-p29-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[22, 23, 45, 82, 89, 92] diff --git a/tasks/agg-p29-n06-s06/tests/test.sh b/tasks/agg-p29-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n08-s01/instruction.md b/tasks/agg-p29-n08-s01/instruction.md index 5b14deaa7622dc83330db4194d812edbd5c8daec..93afa9364b0adb56c55e6be58f7c5120524812fd 100644 --- a/tasks/agg-p29-n08-s01/instruction.md +++ b/tasks/agg-p29-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n08-s01/tests/test.sh b/tasks/agg-p29-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n08-s01/tests/test.sh +++ b/tasks/agg-p29-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n08-s02/instruction.md b/tasks/agg-p29-n08-s02/instruction.md index 8e1b9f225dd41eb13af45ff90735dba5c7d221b8..b9565161529d3e10879a2835bc30196ea1a66220 100644 --- a/tasks/agg-p29-n08-s02/instruction.md +++ b/tasks/agg-p29-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n08-s02/tests/test.sh b/tasks/agg-p29-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n08-s02/tests/test.sh +++ b/tasks/agg-p29-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n08-s03/instruction.md b/tasks/agg-p29-n08-s03/instruction.md index a3ced584309e5034e6a9df4caf622b2a0502c9a5..1500ba63997389cf4258334a4bee45b1f9b4ce39 100644 --- a/tasks/agg-p29-n08-s03/instruction.md +++ b/tasks/agg-p29-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n08-s03/tests/test.sh b/tasks/agg-p29-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n08-s03/tests/test.sh +++ b/tasks/agg-p29-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n08-s04/instruction.md b/tasks/agg-p29-n08-s04/instruction.md index e0a9ed87cd13d7f7ad66688fc91321b44512af39..39881fad07dce830eccfa9e268db7f0e1c5ba5bc 100644 --- a/tasks/agg-p29-n08-s04/instruction.md +++ b/tasks/agg-p29-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n08-s04/tests/test.sh b/tasks/agg-p29-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n08-s04/tests/test.sh +++ b/tasks/agg-p29-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n08-s05/instruction.md b/tasks/agg-p29-n08-s05/instruction.md index cbd8156985f65d76d107221b07326b6deabbfed5..7f6a527995ae5373662b96cfab8f20740ea22c5c 100644 --- a/tasks/agg-p29-n08-s05/instruction.md +++ b/tasks/agg-p29-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n08-s05/tests/test.sh b/tasks/agg-p29-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n08-s05/tests/test.sh +++ b/tasks/agg-p29-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n08-s06/instruction.md b/tasks/agg-p29-n08-s06/instruction.md index 3ef2ec7b4ffc263c27c3bece987fc632ef3cc457..bb55200f8e9216811174b4f1ef5eacfa2a976d3e 100644 --- a/tasks/agg-p29-n08-s06/instruction.md +++ b/tasks/agg-p29-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n08-s06/tests/test.sh b/tasks/agg-p29-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n08-s06/tests/test.sh +++ b/tasks/agg-p29-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n08-s07/instruction.md b/tasks/agg-p29-n08-s07/instruction.md index e21142b6e0df055b0e0bb6899f7eab5e6cc92fb4..afc952163a35fd3b6411c5d3e8199ea1d02f0544 100644 --- a/tasks/agg-p29-n08-s07/instruction.md +++ b/tasks/agg-p29-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n08-s07/tests/test.sh b/tasks/agg-p29-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n08-s07/tests/test.sh +++ b/tasks/agg-p29-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n08-s08/instruction.md b/tasks/agg-p29-n08-s08/instruction.md index b810f3ad633207707958edc8f4de8aaa3b34f710..10c4fa6f85e4cfe5014a312735a2e0f62a2d3254 100644 --- a/tasks/agg-p29-n08-s08/instruction.md +++ b/tasks/agg-p29-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n08-s08/tests/test.sh b/tasks/agg-p29-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n08-s08/tests/test.sh +++ b/tasks/agg-p29-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n12-s01/instruction.md b/tasks/agg-p29-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1ec3d2a16079c4d9737f2784ae217eea77d88533 --- /dev/null +++ b/tasks/agg-p29-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n12-s01/solution/solve.sh b/tasks/agg-p29-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5c375a495d237942c2abea9d6541f01a3382cd22 --- /dev/null +++ b/tasks/agg-p29-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n12-s01/task.toml b/tasks/agg-p29-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6ecc4034af6609e8aea91c32683ffa9cf58bf74b --- /dev/null +++ b/tasks/agg-p29-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n12-s01/tests/expected.json b/tasks/agg-p29-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..91918d333a85bafd36d9c7f1df939e546351490d --- /dev/null +++ b/tasks/agg-p29-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92] diff --git a/tasks/agg-p29-n12-s01/tests/test.sh b/tasks/agg-p29-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n12-s02/instruction.md b/tasks/agg-p29-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b53986e9d0f1dda9020e6d798d3ea3ceceb7b772 --- /dev/null +++ b/tasks/agg-p29-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n12-s02/solution/solve.sh b/tasks/agg-p29-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5c375a495d237942c2abea9d6541f01a3382cd22 --- /dev/null +++ b/tasks/agg-p29-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n12-s02/task.toml b/tasks/agg-p29-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2239d3a6b843adf00ab59ac2b68e6b5f652a537d --- /dev/null +++ b/tasks/agg-p29-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n12-s02/tests/expected.json b/tasks/agg-p29-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..91918d333a85bafd36d9c7f1df939e546351490d --- /dev/null +++ b/tasks/agg-p29-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92] diff --git a/tasks/agg-p29-n12-s02/tests/test.sh b/tasks/agg-p29-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n12-s03/instruction.md b/tasks/agg-p29-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..743bbc1fd4537e0975bd4083d0616f86374f4dee --- /dev/null +++ b/tasks/agg-p29-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n12-s03/solution/solve.sh b/tasks/agg-p29-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5c375a495d237942c2abea9d6541f01a3382cd22 --- /dev/null +++ b/tasks/agg-p29-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n12-s03/task.toml b/tasks/agg-p29-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5b2875556ef25862f900e04b014739d00d140aea --- /dev/null +++ b/tasks/agg-p29-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n12-s03/tests/expected.json b/tasks/agg-p29-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..91918d333a85bafd36d9c7f1df939e546351490d --- /dev/null +++ b/tasks/agg-p29-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92] diff --git a/tasks/agg-p29-n12-s03/tests/test.sh b/tasks/agg-p29-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n12-s04/instruction.md b/tasks/agg-p29-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cf78bc234ac7165a12e4210d637bece975cb648e --- /dev/null +++ b/tasks/agg-p29-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n12-s04/solution/solve.sh b/tasks/agg-p29-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5c375a495d237942c2abea9d6541f01a3382cd22 --- /dev/null +++ b/tasks/agg-p29-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n12-s04/task.toml b/tasks/agg-p29-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fd3f53a2595a10ab9c8513941b2610df499512be --- /dev/null +++ b/tasks/agg-p29-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n12-s04/tests/expected.json b/tasks/agg-p29-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..91918d333a85bafd36d9c7f1df939e546351490d --- /dev/null +++ b/tasks/agg-p29-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92] diff --git a/tasks/agg-p29-n12-s04/tests/test.sh b/tasks/agg-p29-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n12-s05/instruction.md b/tasks/agg-p29-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fb00885ca3bc9d68ddf9fc998c70145bdd52509c --- /dev/null +++ b/tasks/agg-p29-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is ninety-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n12-s05/solution/solve.sh b/tasks/agg-p29-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5c375a495d237942c2abea9d6541f01a3382cd22 --- /dev/null +++ b/tasks/agg-p29-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n12-s05/task.toml b/tasks/agg-p29-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1467e48e6d20d1d922b23a6c2c99cb41037f1bea --- /dev/null +++ b/tasks/agg-p29-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n12-s05/tests/expected.json b/tasks/agg-p29-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..91918d333a85bafd36d9c7f1df939e546351490d --- /dev/null +++ b/tasks/agg-p29-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92] diff --git a/tasks/agg-p29-n12-s05/tests/test.sh b/tasks/agg-p29-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n12-s06/instruction.md b/tasks/agg-p29-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0409dcf29dd269b54d93ca84f2b9a827d9cf7d50 --- /dev/null +++ b/tasks/agg-p29-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n12-s06/solution/solve.sh b/tasks/agg-p29-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5c375a495d237942c2abea9d6541f01a3382cd22 --- /dev/null +++ b/tasks/agg-p29-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n12-s06/task.toml b/tasks/agg-p29-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c4ebad3f49e92789ac06e773d131ed15213d2b43 --- /dev/null +++ b/tasks/agg-p29-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n12-s06/tests/expected.json b/tasks/agg-p29-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..91918d333a85bafd36d9c7f1df939e546351490d --- /dev/null +++ b/tasks/agg-p29-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92] diff --git a/tasks/agg-p29-n12-s06/tests/test.sh b/tasks/agg-p29-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n12-s07/instruction.md b/tasks/agg-p29-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bb40c13254db093b772375b0bb70c64bc0b6f8b8 --- /dev/null +++ b/tasks/agg-p29-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n12-s07/solution/solve.sh b/tasks/agg-p29-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5c375a495d237942c2abea9d6541f01a3382cd22 --- /dev/null +++ b/tasks/agg-p29-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n12-s07/task.toml b/tasks/agg-p29-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..50576fe4264cf1e36381997f44a158efd5861e79 --- /dev/null +++ b/tasks/agg-p29-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n12-s07/tests/expected.json b/tasks/agg-p29-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..91918d333a85bafd36d9c7f1df939e546351490d --- /dev/null +++ b/tasks/agg-p29-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92] diff --git a/tasks/agg-p29-n12-s07/tests/test.sh b/tasks/agg-p29-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n12-s08/instruction.md b/tasks/agg-p29-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2f01a3e73dbd4b8b1058dd60451773afa73f14c7 --- /dev/null +++ b/tasks/agg-p29-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n12-s08/solution/solve.sh b/tasks/agg-p29-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5c375a495d237942c2abea9d6541f01a3382cd22 --- /dev/null +++ b/tasks/agg-p29-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n12-s08/task.toml b/tasks/agg-p29-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b1e319495c357030930463aa1a49376ae4ad2824 --- /dev/null +++ b/tasks/agg-p29-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n12-s08/tests/expected.json b/tasks/agg-p29-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..91918d333a85bafd36d9c7f1df939e546351490d --- /dev/null +++ b/tasks/agg-p29-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92] diff --git a/tasks/agg-p29-n12-s08/tests/test.sh b/tasks/agg-p29-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n12-s09/instruction.md b/tasks/agg-p29-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..894c08d452dd150a471307a3b982c78b62f7152f --- /dev/null +++ b/tasks/agg-p29-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n12-s09/solution/solve.sh b/tasks/agg-p29-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5c375a495d237942c2abea9d6541f01a3382cd22 --- /dev/null +++ b/tasks/agg-p29-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n12-s09/task.toml b/tasks/agg-p29-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..efc6e25a413d9f63e1640429861e3f4025f2eff8 --- /dev/null +++ b/tasks/agg-p29-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n12-s09/tests/expected.json b/tasks/agg-p29-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..91918d333a85bafd36d9c7f1df939e546351490d --- /dev/null +++ b/tasks/agg-p29-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92] diff --git a/tasks/agg-p29-n12-s09/tests/test.sh b/tasks/agg-p29-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n12-s10/instruction.md b/tasks/agg-p29-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cbefd6b3434fac66c24e06d94b9c3c278b95dbfb --- /dev/null +++ b/tasks/agg-p29-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twelve. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n12-s10/solution/solve.sh b/tasks/agg-p29-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5c375a495d237942c2abea9d6541f01a3382cd22 --- /dev/null +++ b/tasks/agg-p29-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n12-s10/task.toml b/tasks/agg-p29-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fba7df4524a4cc276c11ff9cffc226f496b1e743 --- /dev/null +++ b/tasks/agg-p29-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n12-s10/tests/expected.json b/tasks/agg-p29-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..91918d333a85bafd36d9c7f1df939e546351490d --- /dev/null +++ b/tasks/agg-p29-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92] diff --git a/tasks/agg-p29-n12-s10/tests/test.sh b/tasks/agg-p29-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n12-s11/instruction.md b/tasks/agg-p29-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7c90856f9c373634a273d06e4b993632457cf3cf --- /dev/null +++ b/tasks/agg-p29-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n12-s11/solution/solve.sh b/tasks/agg-p29-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5c375a495d237942c2abea9d6541f01a3382cd22 --- /dev/null +++ b/tasks/agg-p29-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n12-s11/task.toml b/tasks/agg-p29-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0d6eb06a0921479c3ec09d612ceb37a6f2e18e36 --- /dev/null +++ b/tasks/agg-p29-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n12-s11/tests/expected.json b/tasks/agg-p29-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..91918d333a85bafd36d9c7f1df939e546351490d --- /dev/null +++ b/tasks/agg-p29-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92] diff --git a/tasks/agg-p29-n12-s11/tests/test.sh b/tasks/agg-p29-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n12-s12/instruction.md b/tasks/agg-p29-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..50b917cf08b6446450c1a43541739f4d5c2745bd --- /dev/null +++ b/tasks/agg-p29-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n12-s12/solution/solve.sh b/tasks/agg-p29-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..5c375a495d237942c2abea9d6541f01a3382cd22 --- /dev/null +++ b/tasks/agg-p29-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92]' > "$answer" diff --git a/tasks/agg-p29-n12-s12/task.toml b/tasks/agg-p29-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cfe2a81761ebf6c3e5f9a573b2e53bf0ba3a52e9 --- /dev/null +++ b/tasks/agg-p29-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p29-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 29 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p29-n12-s12/tests/expected.json b/tasks/agg-p29-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..91918d333a85bafd36d9c7f1df939e546351490d --- /dev/null +++ b/tasks/agg-p29-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[12, 22, 23, 38, 43, 45, 56, 63, 82, 84, 89, 92] diff --git a/tasks/agg-p29-n12-s12/tests/test.sh b/tasks/agg-p29-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p29-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p29-n16-s01/instruction.md b/tasks/agg-p29-n16-s01/instruction.md index 07133633c82ade16a43a26c7ec6cacc19d41b3bd..01eccecf7626f9336ce7f443b7b16b6f87314d4c 100644 --- a/tasks/agg-p29-n16-s01/instruction.md +++ b/tasks/agg-p29-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s01/tests/test.sh b/tasks/agg-p29-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s01/tests/test.sh +++ b/tasks/agg-p29-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s02/instruction.md b/tasks/agg-p29-n16-s02/instruction.md index ac5d07700d94f2ac8dcfe94fa7b7a0669218f24c..b6fbdfaa15c801714d533bc10b7c3a21161186fb 100644 --- a/tasks/agg-p29-n16-s02/instruction.md +++ b/tasks/agg-p29-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s02/tests/test.sh b/tasks/agg-p29-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s02/tests/test.sh +++ b/tasks/agg-p29-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s03/instruction.md b/tasks/agg-p29-n16-s03/instruction.md index 03acbc08880291cf4dacc5df318650e9c8d0e519..d9247c4c1b3fb63a80aa5e8b875de2a3f5be1b29 100644 --- a/tasks/agg-p29-n16-s03/instruction.md +++ b/tasks/agg-p29-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s03/tests/test.sh b/tasks/agg-p29-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s03/tests/test.sh +++ b/tasks/agg-p29-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s04/instruction.md b/tasks/agg-p29-n16-s04/instruction.md index 8719f945164b6c7adba0eec9b9728be32d6bfe5e..10a630b21435ec8e620ae5e83c5dc41b678c1031 100644 --- a/tasks/agg-p29-n16-s04/instruction.md +++ b/tasks/agg-p29-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s04/tests/test.sh b/tasks/agg-p29-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s04/tests/test.sh +++ b/tasks/agg-p29-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s05/instruction.md b/tasks/agg-p29-n16-s05/instruction.md index ff35f53eda015951f8078ff0751a783f65818958..e3de5217dbfb10d0002092b53e5f480dfe257ac6 100644 --- a/tasks/agg-p29-n16-s05/instruction.md +++ b/tasks/agg-p29-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s05/tests/test.sh b/tasks/agg-p29-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s05/tests/test.sh +++ b/tasks/agg-p29-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s06/instruction.md b/tasks/agg-p29-n16-s06/instruction.md index 33c6e5250952f3077456a896c57a642ebd1c8d39..2ed4d1a65ed8a6a1ef17afdd17d82926d08e7770 100644 --- a/tasks/agg-p29-n16-s06/instruction.md +++ b/tasks/agg-p29-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s06/tests/test.sh b/tasks/agg-p29-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s06/tests/test.sh +++ b/tasks/agg-p29-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s07/instruction.md b/tasks/agg-p29-n16-s07/instruction.md index d398ea97722601a49a457530f502678c0a1433cf..e1c1f7d3b01724d8dea774465c5f5d8397b1d161 100644 --- a/tasks/agg-p29-n16-s07/instruction.md +++ b/tasks/agg-p29-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s07/tests/test.sh b/tasks/agg-p29-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s07/tests/test.sh +++ b/tasks/agg-p29-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s08/instruction.md b/tasks/agg-p29-n16-s08/instruction.md index c06c0812a7b7ea5a0caff9ffd07ddd76bc328ac2..769741a0d886c36eda905f6aea67cd579968498f 100644 --- a/tasks/agg-p29-n16-s08/instruction.md +++ b/tasks/agg-p29-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s08/tests/test.sh b/tasks/agg-p29-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s08/tests/test.sh +++ b/tasks/agg-p29-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s09/instruction.md b/tasks/agg-p29-n16-s09/instruction.md index c0f9d178a1c3057c8c4b57e9c5eca4e4c625b138..efa987bc861271d3fcd4cc6f1530e4d2ecbb6990 100644 --- a/tasks/agg-p29-n16-s09/instruction.md +++ b/tasks/agg-p29-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s09/tests/test.sh b/tasks/agg-p29-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s09/tests/test.sh +++ b/tasks/agg-p29-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s10/instruction.md b/tasks/agg-p29-n16-s10/instruction.md index 0d9b54e563f9bb163b48be34eb84abe311c00e06..ceda32fde53a1c10e904f97ed076f49abdf1f3a5 100644 --- a/tasks/agg-p29-n16-s10/instruction.md +++ b/tasks/agg-p29-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s10/tests/test.sh b/tasks/agg-p29-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s10/tests/test.sh +++ b/tasks/agg-p29-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s11/instruction.md b/tasks/agg-p29-n16-s11/instruction.md index eec0889f35f181e3d5ee370338313f8afc894fe8..741d5c897d7dc6413c1bb96a8b00478c60c908ba 100644 --- a/tasks/agg-p29-n16-s11/instruction.md +++ b/tasks/agg-p29-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s11/tests/test.sh b/tasks/agg-p29-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s11/tests/test.sh +++ b/tasks/agg-p29-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s12/instruction.md b/tasks/agg-p29-n16-s12/instruction.md index 7d5ca093d11da3b866f85566039dbc2ac3bc8c84..7fe87dfffe4ad85e98cdbb07e05a77bf8a912afc 100644 --- a/tasks/agg-p29-n16-s12/instruction.md +++ b/tasks/agg-p29-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s12/tests/test.sh b/tasks/agg-p29-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s12/tests/test.sh +++ b/tasks/agg-p29-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s13/instruction.md b/tasks/agg-p29-n16-s13/instruction.md index 1fc02ff38c01961e6ef2d04b50e560edacdcca90..1d5113c5dd5abf3bbd4601fe16ab16e11d5a8b7c 100644 --- a/tasks/agg-p29-n16-s13/instruction.md +++ b/tasks/agg-p29-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s13/tests/test.sh b/tasks/agg-p29-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s13/tests/test.sh +++ b/tasks/agg-p29-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s14/instruction.md b/tasks/agg-p29-n16-s14/instruction.md index a7f0266a5e6733a93cf24a409665e6e92f793dba..d4d40f859809c8e8513c129e910f96795729f446 100644 --- a/tasks/agg-p29-n16-s14/instruction.md +++ b/tasks/agg-p29-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s14/tests/test.sh b/tasks/agg-p29-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s14/tests/test.sh +++ b/tasks/agg-p29-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s15/instruction.md b/tasks/agg-p29-n16-s15/instruction.md index 783fbdc57d72bfcadc0344c5e85549aaa9f3efe7..2ea77ca8a72381d318a57abe0da7ab6c0330246a 100644 --- a/tasks/agg-p29-n16-s15/instruction.md +++ b/tasks/agg-p29-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s15/tests/test.sh b/tasks/agg-p29-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s15/tests/test.sh +++ b/tasks/agg-p29-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p29-n16-s16/instruction.md b/tasks/agg-p29-n16-s16/instruction.md index 0d9b54e563f9bb163b48be34eb84abe311c00e06..ceda32fde53a1c10e904f97ed076f49abdf1f3a5 100644 --- a/tasks/agg-p29-n16-s16/instruction.md +++ b/tasks/agg-p29-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p29-n16-s16/tests/test.sh b/tasks/agg-p29-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p29-n16-s16/tests/test.sh +++ b/tasks/agg-p29-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n01-s01/instruction.md b/tasks/agg-p30-n01-s01/instruction.md index be7de43e766e41adf7f3f09c987b8c3545e68d33..5b6a68c25b70d92b4d60818ca238626d69bb89b9 100644 --- a/tasks/agg-p30-n01-s01/instruction.md +++ b/tasks/agg-p30-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is twenty-one. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p30-n01-s01/tests/test.sh b/tasks/agg-p30-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n01-s01/tests/test.sh +++ b/tasks/agg-p30-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n02-s01/instruction.md b/tasks/agg-p30-n02-s01/instruction.md index 550cdc5c3a47e00d080a9942ae9e64c38ee8e974..8f35404971d0197b36a6c4721ed45744546c6fd7 100644 --- a/tasks/agg-p30-n02-s01/instruction.md +++ b/tasks/agg-p30-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n02-s01/tests/test.sh b/tasks/agg-p30-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n02-s01/tests/test.sh +++ b/tasks/agg-p30-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n02-s02/instruction.md b/tasks/agg-p30-n02-s02/instruction.md index 6ed04da681554d7be4b9aa9edcfd54a3e2bacf72..315b23a9f43b379f64e1430344b5f516c4d8c7d7 100644 --- a/tasks/agg-p30-n02-s02/instruction.md +++ b/tasks/agg-p30-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n02-s02/tests/test.sh b/tasks/agg-p30-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n02-s02/tests/test.sh +++ b/tasks/agg-p30-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n04-s01/instruction.md b/tasks/agg-p30-n04-s01/instruction.md index 1d459a41a5bc548fc489adacacb5b98ea0b37b13..c23c64da948c6fe04dcc8bb31be9e986b6268c53 100644 --- a/tasks/agg-p30-n04-s01/instruction.md +++ b/tasks/agg-p30-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n04-s01/tests/test.sh b/tasks/agg-p30-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n04-s01/tests/test.sh +++ b/tasks/agg-p30-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n04-s02/instruction.md b/tasks/agg-p30-n04-s02/instruction.md index 10ac8a4eaab16f5c9d5a059aa13a56223f70be52..580537b716862c0c2a25f5061693e8c4ccbd726a 100644 --- a/tasks/agg-p30-n04-s02/instruction.md +++ b/tasks/agg-p30-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n04-s02/tests/test.sh b/tasks/agg-p30-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n04-s02/tests/test.sh +++ b/tasks/agg-p30-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n04-s03/instruction.md b/tasks/agg-p30-n04-s03/instruction.md index 16706302237fc8392949449eb048f6bb027a022c..fffa58b02b15fcff7eee47d23096045d666f7865 100644 --- a/tasks/agg-p30-n04-s03/instruction.md +++ b/tasks/agg-p30-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n04-s03/tests/test.sh b/tasks/agg-p30-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n04-s03/tests/test.sh +++ b/tasks/agg-p30-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n04-s04/instruction.md b/tasks/agg-p30-n04-s04/instruction.md index 16706302237fc8392949449eb048f6bb027a022c..fffa58b02b15fcff7eee47d23096045d666f7865 100644 --- a/tasks/agg-p30-n04-s04/instruction.md +++ b/tasks/agg-p30-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n04-s04/tests/test.sh b/tasks/agg-p30-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n04-s04/tests/test.sh +++ b/tasks/agg-p30-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n06-s01/instruction.md b/tasks/agg-p30-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b771c7eadb2a72d02d7a63723c5af1acd80eb156 --- /dev/null +++ b/tasks/agg-p30-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n06-s01/solution/solve.sh b/tasks/agg-p30-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..462479abb812179fa282fa4c778bdf8f40c81529 --- /dev/null +++ b/tasks/agg-p30-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 65, 74, 74]' > "$answer" diff --git a/tasks/agg-p30-n06-s01/task.toml b/tasks/agg-p30-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a830d906a5a4cb6643cceb956b9a1230ca03a6bc --- /dev/null +++ b/tasks/agg-p30-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n06-s01/tests/expected.json b/tasks/agg-p30-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4a87f54982414320cc55263f85af77aebdbd8be7 --- /dev/null +++ b/tasks/agg-p30-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 65, 74, 74] diff --git a/tasks/agg-p30-n06-s01/tests/test.sh b/tasks/agg-p30-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n06-s02/instruction.md b/tasks/agg-p30-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..87a186de4613802ff07f90a3ea674bd2076057bc --- /dev/null +++ b/tasks/agg-p30-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n06-s02/solution/solve.sh b/tasks/agg-p30-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..462479abb812179fa282fa4c778bdf8f40c81529 --- /dev/null +++ b/tasks/agg-p30-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 65, 74, 74]' > "$answer" diff --git a/tasks/agg-p30-n06-s02/task.toml b/tasks/agg-p30-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..376f82b0ccaa341e4e9b1b9e529b1ccf90b92b5b --- /dev/null +++ b/tasks/agg-p30-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n06-s02/tests/expected.json b/tasks/agg-p30-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4a87f54982414320cc55263f85af77aebdbd8be7 --- /dev/null +++ b/tasks/agg-p30-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 65, 74, 74] diff --git a/tasks/agg-p30-n06-s02/tests/test.sh b/tasks/agg-p30-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n06-s03/instruction.md b/tasks/agg-p30-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..938ca4fa446ac3bc537124ef6fffa0d68ee759cb --- /dev/null +++ b/tasks/agg-p30-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n06-s03/solution/solve.sh b/tasks/agg-p30-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..462479abb812179fa282fa4c778bdf8f40c81529 --- /dev/null +++ b/tasks/agg-p30-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 65, 74, 74]' > "$answer" diff --git a/tasks/agg-p30-n06-s03/task.toml b/tasks/agg-p30-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6d77e02f2481d131d76484a20481742f51da2aa4 --- /dev/null +++ b/tasks/agg-p30-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n06-s03/tests/expected.json b/tasks/agg-p30-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4a87f54982414320cc55263f85af77aebdbd8be7 --- /dev/null +++ b/tasks/agg-p30-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 65, 74, 74] diff --git a/tasks/agg-p30-n06-s03/tests/test.sh b/tasks/agg-p30-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n06-s04/instruction.md b/tasks/agg-p30-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..938ca4fa446ac3bc537124ef6fffa0d68ee759cb --- /dev/null +++ b/tasks/agg-p30-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n06-s04/solution/solve.sh b/tasks/agg-p30-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..462479abb812179fa282fa4c778bdf8f40c81529 --- /dev/null +++ b/tasks/agg-p30-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 65, 74, 74]' > "$answer" diff --git a/tasks/agg-p30-n06-s04/task.toml b/tasks/agg-p30-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fabab9cce4e6489d9b643f33e655976ee95ba127 --- /dev/null +++ b/tasks/agg-p30-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n06-s04/tests/expected.json b/tasks/agg-p30-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4a87f54982414320cc55263f85af77aebdbd8be7 --- /dev/null +++ b/tasks/agg-p30-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 65, 74, 74] diff --git a/tasks/agg-p30-n06-s04/tests/test.sh b/tasks/agg-p30-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n06-s05/instruction.md b/tasks/agg-p30-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bc2345670eef592df5089b3576aa387d4b4f7ef0 --- /dev/null +++ b/tasks/agg-p30-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n06-s05/solution/solve.sh b/tasks/agg-p30-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..462479abb812179fa282fa4c778bdf8f40c81529 --- /dev/null +++ b/tasks/agg-p30-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 65, 74, 74]' > "$answer" diff --git a/tasks/agg-p30-n06-s05/task.toml b/tasks/agg-p30-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..84d7fb8c3bb6a488eba8e39a43845ca2834044b6 --- /dev/null +++ b/tasks/agg-p30-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n06-s05/tests/expected.json b/tasks/agg-p30-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4a87f54982414320cc55263f85af77aebdbd8be7 --- /dev/null +++ b/tasks/agg-p30-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 65, 74, 74] diff --git a/tasks/agg-p30-n06-s05/tests/test.sh b/tasks/agg-p30-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n06-s06/instruction.md b/tasks/agg-p30-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b7c38aeb0facd7d0088fe3412efc8eda68a87539 --- /dev/null +++ b/tasks/agg-p30-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n06-s06/solution/solve.sh b/tasks/agg-p30-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..462479abb812179fa282fa4c778bdf8f40c81529 --- /dev/null +++ b/tasks/agg-p30-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 65, 74, 74]' > "$answer" diff --git a/tasks/agg-p30-n06-s06/task.toml b/tasks/agg-p30-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d8de4e02894893a9093bb1a344c71155c9bc5d97 --- /dev/null +++ b/tasks/agg-p30-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n06-s06/tests/expected.json b/tasks/agg-p30-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..4a87f54982414320cc55263f85af77aebdbd8be7 --- /dev/null +++ b/tasks/agg-p30-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 65, 74, 74] diff --git a/tasks/agg-p30-n06-s06/tests/test.sh b/tasks/agg-p30-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n08-s01/instruction.md b/tasks/agg-p30-n08-s01/instruction.md index 05e06432c2ceb1d2a551c09739142cd0234ce3f1..889d2dafb4224e178c94c3b71f63f598a82938ca 100644 --- a/tasks/agg-p30-n08-s01/instruction.md +++ b/tasks/agg-p30-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n08-s01/tests/test.sh b/tasks/agg-p30-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n08-s01/tests/test.sh +++ b/tasks/agg-p30-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n08-s02/instruction.md b/tasks/agg-p30-n08-s02/instruction.md index e5a9078e4c58d734bc89d35a1a10f88352728538..39e243af8207cc8b7adc554fc5ac12d75cb1895b 100644 --- a/tasks/agg-p30-n08-s02/instruction.md +++ b/tasks/agg-p30-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n08-s02/tests/test.sh b/tasks/agg-p30-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n08-s02/tests/test.sh +++ b/tasks/agg-p30-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n08-s03/instruction.md b/tasks/agg-p30-n08-s03/instruction.md index 5dfaf37489d6796e9a47f9dfca5402a1e39e51c2..682c7dbeddcd1c70522b5a7ef3b28dc65cfad7d4 100644 --- a/tasks/agg-p30-n08-s03/instruction.md +++ b/tasks/agg-p30-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n08-s03/tests/test.sh b/tasks/agg-p30-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n08-s03/tests/test.sh +++ b/tasks/agg-p30-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n08-s04/instruction.md b/tasks/agg-p30-n08-s04/instruction.md index 5dfaf37489d6796e9a47f9dfca5402a1e39e51c2..682c7dbeddcd1c70522b5a7ef3b28dc65cfad7d4 100644 --- a/tasks/agg-p30-n08-s04/instruction.md +++ b/tasks/agg-p30-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n08-s04/tests/test.sh b/tasks/agg-p30-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n08-s04/tests/test.sh +++ b/tasks/agg-p30-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n08-s05/instruction.md b/tasks/agg-p30-n08-s05/instruction.md index 2c724ce2f54c8829b6d803659e7e96973259720e..162682e2e51553326a61ee7f19eafb58e7dcde79 100644 --- a/tasks/agg-p30-n08-s05/instruction.md +++ b/tasks/agg-p30-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n08-s05/tests/test.sh b/tasks/agg-p30-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n08-s05/tests/test.sh +++ b/tasks/agg-p30-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n08-s06/instruction.md b/tasks/agg-p30-n08-s06/instruction.md index 46a1349e70b8fdbb194bd99242092f099a7c90c7..f2f920be4b55de49b27362f70eb78f5eaf332718 100644 --- a/tasks/agg-p30-n08-s06/instruction.md +++ b/tasks/agg-p30-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n08-s06/tests/test.sh b/tasks/agg-p30-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n08-s06/tests/test.sh +++ b/tasks/agg-p30-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n08-s07/instruction.md b/tasks/agg-p30-n08-s07/instruction.md index fb0fbc43bc72c36371a3de146c4ffbb7a4304417..838413aa41b8e4bf70f97dc35ce6f9f74b85f116 100644 --- a/tasks/agg-p30-n08-s07/instruction.md +++ b/tasks/agg-p30-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n08-s07/tests/test.sh b/tasks/agg-p30-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n08-s07/tests/test.sh +++ b/tasks/agg-p30-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n08-s08/instruction.md b/tasks/agg-p30-n08-s08/instruction.md index 33c7a00b4080f6f53fe6a6a1b5309b10579c3bc5..10415d93cfa0d6d1cfe2741b569ed7f93bc629a9 100644 --- a/tasks/agg-p30-n08-s08/instruction.md +++ b/tasks/agg-p30-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n08-s08/tests/test.sh b/tasks/agg-p30-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n08-s08/tests/test.sh +++ b/tasks/agg-p30-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n12-s01/instruction.md b/tasks/agg-p30-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0b81ba6377af99eb65b5b6131fb2d1747a9214e3 --- /dev/null +++ b/tasks/agg-p30-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n12-s01/solution/solve.sh b/tasks/agg-p30-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..750ca542cbc0d4d533b53dff5a3f5c7c42fff743 --- /dev/null +++ b/tasks/agg-p30-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89]' > "$answer" diff --git a/tasks/agg-p30-n12-s01/task.toml b/tasks/agg-p30-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ea1ed7f57705f6c3b89a9bae85bd3801cef0bf8c --- /dev/null +++ b/tasks/agg-p30-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n12-s01/tests/expected.json b/tasks/agg-p30-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..13d7bd928490c4fa091ea3185ecb018c974c69c5 --- /dev/null +++ b/tasks/agg-p30-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89] diff --git a/tasks/agg-p30-n12-s01/tests/test.sh b/tasks/agg-p30-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n12-s02/instruction.md b/tasks/agg-p30-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9d09fce34dd764ef615193ac1a5121b1d8ac297a --- /dev/null +++ b/tasks/agg-p30-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n12-s02/solution/solve.sh b/tasks/agg-p30-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..750ca542cbc0d4d533b53dff5a3f5c7c42fff743 --- /dev/null +++ b/tasks/agg-p30-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89]' > "$answer" diff --git a/tasks/agg-p30-n12-s02/task.toml b/tasks/agg-p30-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5610a69a935211642b14acf1c2ab99b2738ce2a9 --- /dev/null +++ b/tasks/agg-p30-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n12-s02/tests/expected.json b/tasks/agg-p30-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..13d7bd928490c4fa091ea3185ecb018c974c69c5 --- /dev/null +++ b/tasks/agg-p30-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89] diff --git a/tasks/agg-p30-n12-s02/tests/test.sh b/tasks/agg-p30-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n12-s03/instruction.md b/tasks/agg-p30-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f7bc3051e09aa70b286064fc6302e7e968c525e --- /dev/null +++ b/tasks/agg-p30-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n12-s03/solution/solve.sh b/tasks/agg-p30-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..750ca542cbc0d4d533b53dff5a3f5c7c42fff743 --- /dev/null +++ b/tasks/agg-p30-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89]' > "$answer" diff --git a/tasks/agg-p30-n12-s03/task.toml b/tasks/agg-p30-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b329a3f65fe95f84295778d96406b66916360c73 --- /dev/null +++ b/tasks/agg-p30-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n12-s03/tests/expected.json b/tasks/agg-p30-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..13d7bd928490c4fa091ea3185ecb018c974c69c5 --- /dev/null +++ b/tasks/agg-p30-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89] diff --git a/tasks/agg-p30-n12-s03/tests/test.sh b/tasks/agg-p30-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n12-s04/instruction.md b/tasks/agg-p30-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f7bc3051e09aa70b286064fc6302e7e968c525e --- /dev/null +++ b/tasks/agg-p30-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n12-s04/solution/solve.sh b/tasks/agg-p30-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..750ca542cbc0d4d533b53dff5a3f5c7c42fff743 --- /dev/null +++ b/tasks/agg-p30-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89]' > "$answer" diff --git a/tasks/agg-p30-n12-s04/task.toml b/tasks/agg-p30-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bf9fab190822de128800dcc8dce85f8c4bf99a24 --- /dev/null +++ b/tasks/agg-p30-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n12-s04/tests/expected.json b/tasks/agg-p30-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..13d7bd928490c4fa091ea3185ecb018c974c69c5 --- /dev/null +++ b/tasks/agg-p30-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89] diff --git a/tasks/agg-p30-n12-s04/tests/test.sh b/tasks/agg-p30-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n12-s05/instruction.md b/tasks/agg-p30-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..894c08d452dd150a471307a3b982c78b62f7152f --- /dev/null +++ b/tasks/agg-p30-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n12-s05/solution/solve.sh b/tasks/agg-p30-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..750ca542cbc0d4d533b53dff5a3f5c7c42fff743 --- /dev/null +++ b/tasks/agg-p30-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89]' > "$answer" diff --git a/tasks/agg-p30-n12-s05/task.toml b/tasks/agg-p30-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c7e6b1713b8731bd69f566289c16d88c456526ba --- /dev/null +++ b/tasks/agg-p30-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n12-s05/tests/expected.json b/tasks/agg-p30-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..13d7bd928490c4fa091ea3185ecb018c974c69c5 --- /dev/null +++ b/tasks/agg-p30-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89] diff --git a/tasks/agg-p30-n12-s05/tests/test.sh b/tasks/agg-p30-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n12-s06/instruction.md b/tasks/agg-p30-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f3a02bb6e52e493404bcac9983ca2aabf003220d --- /dev/null +++ b/tasks/agg-p30-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n12-s06/solution/solve.sh b/tasks/agg-p30-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..750ca542cbc0d4d533b53dff5a3f5c7c42fff743 --- /dev/null +++ b/tasks/agg-p30-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89]' > "$answer" diff --git a/tasks/agg-p30-n12-s06/task.toml b/tasks/agg-p30-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d4c05c09e70c3a773d38ad9fa4f92b52e5c7baa4 --- /dev/null +++ b/tasks/agg-p30-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n12-s06/tests/expected.json b/tasks/agg-p30-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..13d7bd928490c4fa091ea3185ecb018c974c69c5 --- /dev/null +++ b/tasks/agg-p30-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89] diff --git a/tasks/agg-p30-n12-s06/tests/test.sh b/tasks/agg-p30-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n12-s07/instruction.md b/tasks/agg-p30-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..619b52b72dd0e0fb5294f24176b256347b8b4527 --- /dev/null +++ b/tasks/agg-p30-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n12-s07/solution/solve.sh b/tasks/agg-p30-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..750ca542cbc0d4d533b53dff5a3f5c7c42fff743 --- /dev/null +++ b/tasks/agg-p30-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89]' > "$answer" diff --git a/tasks/agg-p30-n12-s07/task.toml b/tasks/agg-p30-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b50179b9a66d18ae32c09414d2f18d1086aa3362 --- /dev/null +++ b/tasks/agg-p30-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n12-s07/tests/expected.json b/tasks/agg-p30-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..13d7bd928490c4fa091ea3185ecb018c974c69c5 --- /dev/null +++ b/tasks/agg-p30-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89] diff --git a/tasks/agg-p30-n12-s07/tests/test.sh b/tasks/agg-p30-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n12-s08/instruction.md b/tasks/agg-p30-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..031c703efd3d4ee9d7e52a3211272bdd8fdb3bc4 --- /dev/null +++ b/tasks/agg-p30-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n12-s08/solution/solve.sh b/tasks/agg-p30-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..750ca542cbc0d4d533b53dff5a3f5c7c42fff743 --- /dev/null +++ b/tasks/agg-p30-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89]' > "$answer" diff --git a/tasks/agg-p30-n12-s08/task.toml b/tasks/agg-p30-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5aece2d52a4d109a9c15775d30b567b361328f72 --- /dev/null +++ b/tasks/agg-p30-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n12-s08/tests/expected.json b/tasks/agg-p30-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..13d7bd928490c4fa091ea3185ecb018c974c69c5 --- /dev/null +++ b/tasks/agg-p30-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89] diff --git a/tasks/agg-p30-n12-s08/tests/test.sh b/tasks/agg-p30-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n12-s09/instruction.md b/tasks/agg-p30-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..894c08d452dd150a471307a3b982c78b62f7152f --- /dev/null +++ b/tasks/agg-p30-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n12-s09/solution/solve.sh b/tasks/agg-p30-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..750ca542cbc0d4d533b53dff5a3f5c7c42fff743 --- /dev/null +++ b/tasks/agg-p30-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89]' > "$answer" diff --git a/tasks/agg-p30-n12-s09/task.toml b/tasks/agg-p30-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..20de0ad54cfec6d7502f52293683d41c372b1cb2 --- /dev/null +++ b/tasks/agg-p30-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n12-s09/tests/expected.json b/tasks/agg-p30-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..13d7bd928490c4fa091ea3185ecb018c974c69c5 --- /dev/null +++ b/tasks/agg-p30-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89] diff --git a/tasks/agg-p30-n12-s09/tests/test.sh b/tasks/agg-p30-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n12-s10/instruction.md b/tasks/agg-p30-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0409dcf29dd269b54d93ca84f2b9a827d9cf7d50 --- /dev/null +++ b/tasks/agg-p30-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n12-s10/solution/solve.sh b/tasks/agg-p30-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..750ca542cbc0d4d533b53dff5a3f5c7c42fff743 --- /dev/null +++ b/tasks/agg-p30-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89]' > "$answer" diff --git a/tasks/agg-p30-n12-s10/task.toml b/tasks/agg-p30-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..de63b463c914691ff0327f60523720b570e1aff8 --- /dev/null +++ b/tasks/agg-p30-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n12-s10/tests/expected.json b/tasks/agg-p30-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..13d7bd928490c4fa091ea3185ecb018c974c69c5 --- /dev/null +++ b/tasks/agg-p30-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89] diff --git a/tasks/agg-p30-n12-s10/tests/test.sh b/tasks/agg-p30-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n12-s11/instruction.md b/tasks/agg-p30-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..894c08d452dd150a471307a3b982c78b62f7152f --- /dev/null +++ b/tasks/agg-p30-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n12-s11/solution/solve.sh b/tasks/agg-p30-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..750ca542cbc0d4d533b53dff5a3f5c7c42fff743 --- /dev/null +++ b/tasks/agg-p30-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89]' > "$answer" diff --git a/tasks/agg-p30-n12-s11/task.toml b/tasks/agg-p30-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d15076bf0b6d870ca15061bd6475f0f813facd70 --- /dev/null +++ b/tasks/agg-p30-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n12-s11/tests/expected.json b/tasks/agg-p30-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..13d7bd928490c4fa091ea3185ecb018c974c69c5 --- /dev/null +++ b/tasks/agg-p30-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89] diff --git a/tasks/agg-p30-n12-s11/tests/test.sh b/tasks/agg-p30-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n12-s12/instruction.md b/tasks/agg-p30-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b23cc64451ba67760e7585b5affddf553a657ad0 --- /dev/null +++ b/tasks/agg-p30-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n12-s12/solution/solve.sh b/tasks/agg-p30-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..750ca542cbc0d4d533b53dff5a3f5c7c42fff743 --- /dev/null +++ b/tasks/agg-p30-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89]' > "$answer" diff --git a/tasks/agg-p30-n12-s12/task.toml b/tasks/agg-p30-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3c642c9a3987473e36a2b5cf22c48e3a1422dfe2 --- /dev/null +++ b/tasks/agg-p30-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p30-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 30 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p30-n12-s12/tests/expected.json b/tasks/agg-p30-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..13d7bd928490c4fa091ea3185ecb018c974c69c5 --- /dev/null +++ b/tasks/agg-p30-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[21, 41, 43, 43, 43, 53, 61, 65, 74, 74, 87, 89] diff --git a/tasks/agg-p30-n12-s12/tests/test.sh b/tasks/agg-p30-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p30-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p30-n16-s01/instruction.md b/tasks/agg-p30-n16-s01/instruction.md index 1499aaac42fb5c39eb3846670f67c71d3d44d289..b294d334efb52a9a07adec52a680b842f6ba6953 100644 --- a/tasks/agg-p30-n16-s01/instruction.md +++ b/tasks/agg-p30-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s01/tests/test.sh b/tasks/agg-p30-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s01/tests/test.sh +++ b/tasks/agg-p30-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s02/instruction.md b/tasks/agg-p30-n16-s02/instruction.md index c9f61576dcb8ea2769bc6b953c327b5baba2bb54..728715ff5a180904d17bdd4c6d3921ea7a2eb170 100644 --- a/tasks/agg-p30-n16-s02/instruction.md +++ b/tasks/agg-p30-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s02/tests/test.sh b/tasks/agg-p30-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s02/tests/test.sh +++ b/tasks/agg-p30-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s03/instruction.md b/tasks/agg-p30-n16-s03/instruction.md index bb8416d585abe15f78ad9eaf98f78cbb202e2f9a..d2b26950540de67dd00f1a8d6c3d9b9c9c52ddf0 100644 --- a/tasks/agg-p30-n16-s03/instruction.md +++ b/tasks/agg-p30-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s03/tests/test.sh b/tasks/agg-p30-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s03/tests/test.sh +++ b/tasks/agg-p30-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s04/instruction.md b/tasks/agg-p30-n16-s04/instruction.md index bb8416d585abe15f78ad9eaf98f78cbb202e2f9a..d2b26950540de67dd00f1a8d6c3d9b9c9c52ddf0 100644 --- a/tasks/agg-p30-n16-s04/instruction.md +++ b/tasks/agg-p30-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s04/tests/test.sh b/tasks/agg-p30-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s04/tests/test.sh +++ b/tasks/agg-p30-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s05/instruction.md b/tasks/agg-p30-n16-s05/instruction.md index c0f9d178a1c3057c8c4b57e9c5eca4e4c625b138..efa987bc861271d3fcd4cc6f1530e4d2ecbb6990 100644 --- a/tasks/agg-p30-n16-s05/instruction.md +++ b/tasks/agg-p30-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s05/tests/test.sh b/tasks/agg-p30-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s05/tests/test.sh +++ b/tasks/agg-p30-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s06/instruction.md b/tasks/agg-p30-n16-s06/instruction.md index 356ad9a55f491febf5d0b5a7f08b59d72a30b581..eeb8d1d20be418011c3de786ceee7d8938bcc672 100644 --- a/tasks/agg-p30-n16-s06/instruction.md +++ b/tasks/agg-p30-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s06/tests/test.sh b/tasks/agg-p30-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s06/tests/test.sh +++ b/tasks/agg-p30-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s07/instruction.md b/tasks/agg-p30-n16-s07/instruction.md index d019999eecd81b0d102088ffd8dc6702e314773f..0800edc3b640ede26ab3978765dad5c40d1446ad 100644 --- a/tasks/agg-p30-n16-s07/instruction.md +++ b/tasks/agg-p30-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s07/tests/test.sh b/tasks/agg-p30-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s07/tests/test.sh +++ b/tasks/agg-p30-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s08/instruction.md b/tasks/agg-p30-n16-s08/instruction.md index 3c1a8c1b0c33b8354227b277a5b1885c3067b4d2..6a9948c4088c17e7b78a078e0010c060500c2e8e 100644 --- a/tasks/agg-p30-n16-s08/instruction.md +++ b/tasks/agg-p30-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s08/tests/test.sh b/tasks/agg-p30-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s08/tests/test.sh +++ b/tasks/agg-p30-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s09/instruction.md b/tasks/agg-p30-n16-s09/instruction.md index c0f9d178a1c3057c8c4b57e9c5eca4e4c625b138..efa987bc861271d3fcd4cc6f1530e4d2ecbb6990 100644 --- a/tasks/agg-p30-n16-s09/instruction.md +++ b/tasks/agg-p30-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s09/tests/test.sh b/tasks/agg-p30-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s09/tests/test.sh +++ b/tasks/agg-p30-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s10/instruction.md b/tasks/agg-p30-n16-s10/instruction.md index 33c6e5250952f3077456a896c57a642ebd1c8d39..2ed4d1a65ed8a6a1ef17afdd17d82926d08e7770 100644 --- a/tasks/agg-p30-n16-s10/instruction.md +++ b/tasks/agg-p30-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s10/tests/test.sh b/tasks/agg-p30-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s10/tests/test.sh +++ b/tasks/agg-p30-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s11/instruction.md b/tasks/agg-p30-n16-s11/instruction.md index c0f9d178a1c3057c8c4b57e9c5eca4e4c625b138..efa987bc861271d3fcd4cc6f1530e4d2ecbb6990 100644 --- a/tasks/agg-p30-n16-s11/instruction.md +++ b/tasks/agg-p30-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s11/tests/test.sh b/tasks/agg-p30-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s11/tests/test.sh +++ b/tasks/agg-p30-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s12/instruction.md b/tasks/agg-p30-n16-s12/instruction.md index 72bbb260a72c8a03816a7f046d2bafe5f6b145f2..fe4f0325e372e3a12281df6aa7a7ff5ffc6e5d94 100644 --- a/tasks/agg-p30-n16-s12/instruction.md +++ b/tasks/agg-p30-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s12/tests/test.sh b/tasks/agg-p30-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s12/tests/test.sh +++ b/tasks/agg-p30-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s13/instruction.md b/tasks/agg-p30-n16-s13/instruction.md index c9f61576dcb8ea2769bc6b953c327b5baba2bb54..728715ff5a180904d17bdd4c6d3921ea7a2eb170 100644 --- a/tasks/agg-p30-n16-s13/instruction.md +++ b/tasks/agg-p30-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s13/tests/test.sh b/tasks/agg-p30-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s13/tests/test.sh +++ b/tasks/agg-p30-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s14/instruction.md b/tasks/agg-p30-n16-s14/instruction.md index 635dd02b39036aac45824980be06065d4cdbba80..df537d63f89b272009aff77b78050806566e850d 100644 --- a/tasks/agg-p30-n16-s14/instruction.md +++ b/tasks/agg-p30-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s14/tests/test.sh b/tasks/agg-p30-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s14/tests/test.sh +++ b/tasks/agg-p30-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s15/instruction.md b/tasks/agg-p30-n16-s15/instruction.md index 2b88f98c808d50d8812e112db76251266368fe80..3162a9d23282256e321282ae9170e9de281da28f 100644 --- a/tasks/agg-p30-n16-s15/instruction.md +++ b/tasks/agg-p30-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s15/tests/test.sh b/tasks/agg-p30-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s15/tests/test.sh +++ b/tasks/agg-p30-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p30-n16-s16/instruction.md b/tasks/agg-p30-n16-s16/instruction.md index 552ad7b188277feadeb521fd17ec24a6f1f8f5ae..50bdd007515ead22fc5cdc1b26c44d0d9cdd48d1 100644 --- a/tasks/agg-p30-n16-s16/instruction.md +++ b/tasks/agg-p30-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p30-n16-s16/tests/test.sh b/tasks/agg-p30-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p30-n16-s16/tests/test.sh +++ b/tasks/agg-p30-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n01-s01/instruction.md b/tasks/agg-p31-n01-s01/instruction.md index b099d4e7a76a14c19070ce72654b8b1948262d8f..4f7c0a817ca98c3a3dd65a3e62b38ebb5818bf2a 100644 --- a/tasks/agg-p31-n01-s01/instruction.md +++ b/tasks/agg-p31-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is twenty-five. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p31-n01-s01/tests/test.sh b/tasks/agg-p31-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n01-s01/tests/test.sh +++ b/tasks/agg-p31-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n02-s01/instruction.md b/tasks/agg-p31-n02-s01/instruction.md index 40a4a23cf0342c0340b103039016ca5942d6299c..9398d39e66800aa393834351efebb7c3ed074e01 100644 --- a/tasks/agg-p31-n02-s01/instruction.md +++ b/tasks/agg-p31-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n02-s01/tests/test.sh b/tasks/agg-p31-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n02-s01/tests/test.sh +++ b/tasks/agg-p31-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n02-s02/instruction.md b/tasks/agg-p31-n02-s02/instruction.md index c0bd303417274bf1a0c037286116fba257c99c87..0a79a1ed43ac78a99007d72b4caa104823ac0512 100644 --- a/tasks/agg-p31-n02-s02/instruction.md +++ b/tasks/agg-p31-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n02-s02/tests/test.sh b/tasks/agg-p31-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n02-s02/tests/test.sh +++ b/tasks/agg-p31-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n04-s01/instruction.md b/tasks/agg-p31-n04-s01/instruction.md index 949c76cb30450f2a84c21b5ba45e60cae4e2e284..f49b5a6116bb364c68e34bd03054f7e4d8834b35 100644 --- a/tasks/agg-p31-n04-s01/instruction.md +++ b/tasks/agg-p31-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n04-s01/tests/test.sh b/tasks/agg-p31-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n04-s01/tests/test.sh +++ b/tasks/agg-p31-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n04-s02/instruction.md b/tasks/agg-p31-n04-s02/instruction.md index 68b7508bd8f70bb90517cd8b23e9d1db9ea72eca..d96933241d61e955fa8544e894ba163c34a7af6e 100644 --- a/tasks/agg-p31-n04-s02/instruction.md +++ b/tasks/agg-p31-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n04-s02/tests/test.sh b/tasks/agg-p31-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n04-s02/tests/test.sh +++ b/tasks/agg-p31-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n04-s03/instruction.md b/tasks/agg-p31-n04-s03/instruction.md index 4e0ea7af0cbf9f514ae40b7ebdeb8125d1ab0241..f638f78ced32ce4c34ebe7b9c35c5e4caf8ae14f 100644 --- a/tasks/agg-p31-n04-s03/instruction.md +++ b/tasks/agg-p31-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n04-s03/tests/test.sh b/tasks/agg-p31-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n04-s03/tests/test.sh +++ b/tasks/agg-p31-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n04-s04/instruction.md b/tasks/agg-p31-n04-s04/instruction.md index d59f0bb832693f2ff4db4518640ba1d7223973e9..5646a1e56523ac12f29da21f0ac795a2ce32426c 100644 --- a/tasks/agg-p31-n04-s04/instruction.md +++ b/tasks/agg-p31-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n04-s04/tests/test.sh b/tasks/agg-p31-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n04-s04/tests/test.sh +++ b/tasks/agg-p31-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n06-s01/instruction.md b/tasks/agg-p31-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f9e883bdc9bff7ab7a0b8faee044c945ab0a1ced --- /dev/null +++ b/tasks/agg-p31-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n06-s01/solution/solve.sh b/tasks/agg-p31-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1450a7b65d8731c942ff0a3a5edcbb928043535b --- /dev/null +++ b/tasks/agg-p31-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 23, 25, 28, 36, 82]' > "$answer" diff --git a/tasks/agg-p31-n06-s01/task.toml b/tasks/agg-p31-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b7b7d156c9d8f58cfce3688977eb4f0fdd19d5ad --- /dev/null +++ b/tasks/agg-p31-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n06-s01/tests/expected.json b/tasks/agg-p31-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..b7753745d22c1a1539f65c112e8061154c345b91 --- /dev/null +++ b/tasks/agg-p31-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[4, 23, 25, 28, 36, 82] diff --git a/tasks/agg-p31-n06-s01/tests/test.sh b/tasks/agg-p31-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n06-s02/instruction.md b/tasks/agg-p31-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..db46a85781c5f4b05255f5b663546479ae052559 --- /dev/null +++ b/tasks/agg-p31-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n06-s02/solution/solve.sh b/tasks/agg-p31-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1450a7b65d8731c942ff0a3a5edcbb928043535b --- /dev/null +++ b/tasks/agg-p31-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 23, 25, 28, 36, 82]' > "$answer" diff --git a/tasks/agg-p31-n06-s02/task.toml b/tasks/agg-p31-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b3aa0a9a06602d36a8a20e016f19a68ea25916a4 --- /dev/null +++ b/tasks/agg-p31-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n06-s02/tests/expected.json b/tasks/agg-p31-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..b7753745d22c1a1539f65c112e8061154c345b91 --- /dev/null +++ b/tasks/agg-p31-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[4, 23, 25, 28, 36, 82] diff --git a/tasks/agg-p31-n06-s02/tests/test.sh b/tasks/agg-p31-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n06-s03/instruction.md b/tasks/agg-p31-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..745b2ae16840e1bcb6509c8b0b1545c62eecc1f6 --- /dev/null +++ b/tasks/agg-p31-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is four. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n06-s03/solution/solve.sh b/tasks/agg-p31-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1450a7b65d8731c942ff0a3a5edcbb928043535b --- /dev/null +++ b/tasks/agg-p31-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 23, 25, 28, 36, 82]' > "$answer" diff --git a/tasks/agg-p31-n06-s03/task.toml b/tasks/agg-p31-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f2c783a1e14ccd314f0ec54f2f5f1dd761e59aa2 --- /dev/null +++ b/tasks/agg-p31-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n06-s03/tests/expected.json b/tasks/agg-p31-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..b7753745d22c1a1539f65c112e8061154c345b91 --- /dev/null +++ b/tasks/agg-p31-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[4, 23, 25, 28, 36, 82] diff --git a/tasks/agg-p31-n06-s03/tests/test.sh b/tasks/agg-p31-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n06-s04/instruction.md b/tasks/agg-p31-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..646aa6fe77ffd0dcaac27a989fcd74a9b9cf343d --- /dev/null +++ b/tasks/agg-p31-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n06-s04/solution/solve.sh b/tasks/agg-p31-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1450a7b65d8731c942ff0a3a5edcbb928043535b --- /dev/null +++ b/tasks/agg-p31-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 23, 25, 28, 36, 82]' > "$answer" diff --git a/tasks/agg-p31-n06-s04/task.toml b/tasks/agg-p31-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bd8fddd7b74f0a0a9f472ac29d06ab6161fc8ba7 --- /dev/null +++ b/tasks/agg-p31-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n06-s04/tests/expected.json b/tasks/agg-p31-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..b7753745d22c1a1539f65c112e8061154c345b91 --- /dev/null +++ b/tasks/agg-p31-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[4, 23, 25, 28, 36, 82] diff --git a/tasks/agg-p31-n06-s04/tests/test.sh b/tasks/agg-p31-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n06-s05/instruction.md b/tasks/agg-p31-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d8bab66eb3d5058caae65c9939daace434a1e497 --- /dev/null +++ b/tasks/agg-p31-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-two. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n06-s05/solution/solve.sh b/tasks/agg-p31-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1450a7b65d8731c942ff0a3a5edcbb928043535b --- /dev/null +++ b/tasks/agg-p31-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 23, 25, 28, 36, 82]' > "$answer" diff --git a/tasks/agg-p31-n06-s05/task.toml b/tasks/agg-p31-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9562d5920f7659e70ba95081811a181376ba4313 --- /dev/null +++ b/tasks/agg-p31-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n06-s05/tests/expected.json b/tasks/agg-p31-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..b7753745d22c1a1539f65c112e8061154c345b91 --- /dev/null +++ b/tasks/agg-p31-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[4, 23, 25, 28, 36, 82] diff --git a/tasks/agg-p31-n06-s05/tests/test.sh b/tasks/agg-p31-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n06-s06/instruction.md b/tasks/agg-p31-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..92374d6aebf10da80fd0982558814df5b0b26473 --- /dev/null +++ b/tasks/agg-p31-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-eight. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n06-s06/solution/solve.sh b/tasks/agg-p31-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..1450a7b65d8731c942ff0a3a5edcbb928043535b --- /dev/null +++ b/tasks/agg-p31-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[4, 23, 25, 28, 36, 82]' > "$answer" diff --git a/tasks/agg-p31-n06-s06/task.toml b/tasks/agg-p31-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e77e5e85928a7e5f247f88be4370696e431aa2ca --- /dev/null +++ b/tasks/agg-p31-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n06-s06/tests/expected.json b/tasks/agg-p31-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..b7753745d22c1a1539f65c112e8061154c345b91 --- /dev/null +++ b/tasks/agg-p31-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[4, 23, 25, 28, 36, 82] diff --git a/tasks/agg-p31-n06-s06/tests/test.sh b/tasks/agg-p31-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n08-s01/instruction.md b/tasks/agg-p31-n08-s01/instruction.md index eee7a0b5f66fc3863f0f9be834031a101d16805b..e18ab9027af739e0c6a8e15c489ac72b51badfe0 100644 --- a/tasks/agg-p31-n08-s01/instruction.md +++ b/tasks/agg-p31-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n08-s01/tests/test.sh b/tasks/agg-p31-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n08-s01/tests/test.sh +++ b/tasks/agg-p31-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n08-s02/instruction.md b/tasks/agg-p31-n08-s02/instruction.md index 5b14deaa7622dc83330db4194d812edbd5c8daec..93afa9364b0adb56c55e6be58f7c5120524812fd 100644 --- a/tasks/agg-p31-n08-s02/instruction.md +++ b/tasks/agg-p31-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n08-s02/tests/test.sh b/tasks/agg-p31-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n08-s02/tests/test.sh +++ b/tasks/agg-p31-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n08-s03/instruction.md b/tasks/agg-p31-n08-s03/instruction.md index 26ddb6283c1971f9d81edaec183ef7aadd75290a..3ac56c4ea8687b7dfe32e2c55bd3311e97d6944e 100644 --- a/tasks/agg-p31-n08-s03/instruction.md +++ b/tasks/agg-p31-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n08-s03/tests/test.sh b/tasks/agg-p31-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n08-s03/tests/test.sh +++ b/tasks/agg-p31-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n08-s04/instruction.md b/tasks/agg-p31-n08-s04/instruction.md index 4eccb674ece1f5e87026a82210d8ef4929435c03..1c8272e27cf6f88e7404b4647a540b918219e839 100644 --- a/tasks/agg-p31-n08-s04/instruction.md +++ b/tasks/agg-p31-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n08-s04/tests/test.sh b/tasks/agg-p31-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n08-s04/tests/test.sh +++ b/tasks/agg-p31-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n08-s05/instruction.md b/tasks/agg-p31-n08-s05/instruction.md index e0a9ed87cd13d7f7ad66688fc91321b44512af39..39881fad07dce830eccfa9e268db7f0e1c5ba5bc 100644 --- a/tasks/agg-p31-n08-s05/instruction.md +++ b/tasks/agg-p31-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n08-s05/tests/test.sh b/tasks/agg-p31-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n08-s05/tests/test.sh +++ b/tasks/agg-p31-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n08-s06/instruction.md b/tasks/agg-p31-n08-s06/instruction.md index d68437db8876ac35a7b4f4d581f65794c16fd18e..4bbcdf67f91cd3d8f22aa7bf38afe075028d41cf 100644 --- a/tasks/agg-p31-n08-s06/instruction.md +++ b/tasks/agg-p31-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n08-s06/tests/test.sh b/tasks/agg-p31-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n08-s06/tests/test.sh +++ b/tasks/agg-p31-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n08-s07/instruction.md b/tasks/agg-p31-n08-s07/instruction.md index 820ba5235eb72205ef96f9b1bab51820f47403d9..e0abdd89b76cbe13833aaa27e72fee82f7079852 100644 --- a/tasks/agg-p31-n08-s07/instruction.md +++ b/tasks/agg-p31-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n08-s07/tests/test.sh b/tasks/agg-p31-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n08-s07/tests/test.sh +++ b/tasks/agg-p31-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n08-s08/instruction.md b/tasks/agg-p31-n08-s08/instruction.md index a1e2c3224bd97f4013ada3fc21fbfd4bf8f9f127..233ddf75e4743ba7e79489d88d27ae5f8ca9c8af 100644 --- a/tasks/agg-p31-n08-s08/instruction.md +++ b/tasks/agg-p31-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n08-s08/tests/test.sh b/tasks/agg-p31-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n08-s08/tests/test.sh +++ b/tasks/agg-p31-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n12-s01/instruction.md b/tasks/agg-p31-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..297e7df5ad0e1e0ae0182d7fbd8be00d892a2f7e --- /dev/null +++ b/tasks/agg-p31-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n12-s01/solution/solve.sh b/tasks/agg-p31-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2c9c1a1e6070980f457eab7c4b91f218f6f71d5 --- /dev/null +++ b/tasks/agg-p31-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82]' > "$answer" diff --git a/tasks/agg-p31-n12-s01/task.toml b/tasks/agg-p31-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..62468573ac5c00b7b3fc77f36a0031f2fe946569 --- /dev/null +++ b/tasks/agg-p31-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n12-s01/tests/expected.json b/tasks/agg-p31-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..271db4cf87fa353789878440febd8b5f48e7d8c2 --- /dev/null +++ b/tasks/agg-p31-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82] diff --git a/tasks/agg-p31-n12-s01/tests/test.sh b/tasks/agg-p31-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n12-s02/instruction.md b/tasks/agg-p31-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1ec3d2a16079c4d9737f2784ae217eea77d88533 --- /dev/null +++ b/tasks/agg-p31-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n12-s02/solution/solve.sh b/tasks/agg-p31-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2c9c1a1e6070980f457eab7c4b91f218f6f71d5 --- /dev/null +++ b/tasks/agg-p31-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82]' > "$answer" diff --git a/tasks/agg-p31-n12-s02/task.toml b/tasks/agg-p31-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1073aafd3cba171b6ee8ffa9aa8714982e8bbfc3 --- /dev/null +++ b/tasks/agg-p31-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n12-s02/tests/expected.json b/tasks/agg-p31-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..271db4cf87fa353789878440febd8b5f48e7d8c2 --- /dev/null +++ b/tasks/agg-p31-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82] diff --git a/tasks/agg-p31-n12-s02/tests/test.sh b/tasks/agg-p31-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n12-s03/instruction.md b/tasks/agg-p31-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..519523fa549585a9595ce676c83c5ebd96f5e138 --- /dev/null +++ b/tasks/agg-p31-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is four. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n12-s03/solution/solve.sh b/tasks/agg-p31-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2c9c1a1e6070980f457eab7c4b91f218f6f71d5 --- /dev/null +++ b/tasks/agg-p31-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82]' > "$answer" diff --git a/tasks/agg-p31-n12-s03/task.toml b/tasks/agg-p31-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..98d652add16c93ae34f790a750ea2885eeff0016 --- /dev/null +++ b/tasks/agg-p31-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n12-s03/tests/expected.json b/tasks/agg-p31-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..271db4cf87fa353789878440febd8b5f48e7d8c2 --- /dev/null +++ b/tasks/agg-p31-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82] diff --git a/tasks/agg-p31-n12-s03/tests/test.sh b/tasks/agg-p31-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n12-s04/instruction.md b/tasks/agg-p31-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9aaef5446517a1b0321eb9b44f6a98f04db290b5 --- /dev/null +++ b/tasks/agg-p31-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n12-s04/solution/solve.sh b/tasks/agg-p31-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2c9c1a1e6070980f457eab7c4b91f218f6f71d5 --- /dev/null +++ b/tasks/agg-p31-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82]' > "$answer" diff --git a/tasks/agg-p31-n12-s04/task.toml b/tasks/agg-p31-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..352415edd6b427b8e66baebd99038ad7b13c054b --- /dev/null +++ b/tasks/agg-p31-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n12-s04/tests/expected.json b/tasks/agg-p31-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..271db4cf87fa353789878440febd8b5f48e7d8c2 --- /dev/null +++ b/tasks/agg-p31-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82] diff --git a/tasks/agg-p31-n12-s04/tests/test.sh b/tasks/agg-p31-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n12-s05/instruction.md b/tasks/agg-p31-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cf78bc234ac7165a12e4210d637bece975cb648e --- /dev/null +++ b/tasks/agg-p31-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n12-s05/solution/solve.sh b/tasks/agg-p31-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2c9c1a1e6070980f457eab7c4b91f218f6f71d5 --- /dev/null +++ b/tasks/agg-p31-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82]' > "$answer" diff --git a/tasks/agg-p31-n12-s05/task.toml b/tasks/agg-p31-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..35263abe9573f8e077c45e3d2e702ed13d8fb5da --- /dev/null +++ b/tasks/agg-p31-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n12-s05/tests/expected.json b/tasks/agg-p31-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..271db4cf87fa353789878440febd8b5f48e7d8c2 --- /dev/null +++ b/tasks/agg-p31-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82] diff --git a/tasks/agg-p31-n12-s05/tests/test.sh b/tasks/agg-p31-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n12-s06/instruction.md b/tasks/agg-p31-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c399924136c6d7da50558e3aaeced49158dfd9dc --- /dev/null +++ b/tasks/agg-p31-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n12-s06/solution/solve.sh b/tasks/agg-p31-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2c9c1a1e6070980f457eab7c4b91f218f6f71d5 --- /dev/null +++ b/tasks/agg-p31-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82]' > "$answer" diff --git a/tasks/agg-p31-n12-s06/task.toml b/tasks/agg-p31-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b496b0c4fd174d4ef6ca681e307b52a8a4ea59c9 --- /dev/null +++ b/tasks/agg-p31-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n12-s06/tests/expected.json b/tasks/agg-p31-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..271db4cf87fa353789878440febd8b5f48e7d8c2 --- /dev/null +++ b/tasks/agg-p31-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82] diff --git a/tasks/agg-p31-n12-s06/tests/test.sh b/tasks/agg-p31-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n12-s07/instruction.md b/tasks/agg-p31-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a6f6c527d4c1aacdad41d32eff67af8f36c275ba --- /dev/null +++ b/tasks/agg-p31-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n12-s07/solution/solve.sh b/tasks/agg-p31-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2c9c1a1e6070980f457eab7c4b91f218f6f71d5 --- /dev/null +++ b/tasks/agg-p31-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82]' > "$answer" diff --git a/tasks/agg-p31-n12-s07/task.toml b/tasks/agg-p31-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d7ae0785bdd4e9b864e5eaf5ab92c7ec70eaa798 --- /dev/null +++ b/tasks/agg-p31-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n12-s07/tests/expected.json b/tasks/agg-p31-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..271db4cf87fa353789878440febd8b5f48e7d8c2 --- /dev/null +++ b/tasks/agg-p31-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82] diff --git a/tasks/agg-p31-n12-s07/tests/test.sh b/tasks/agg-p31-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n12-s08/instruction.md b/tasks/agg-p31-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..afbeda4e94399ae98c38833dd1dd245acc819d21 --- /dev/null +++ b/tasks/agg-p31-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n12-s08/solution/solve.sh b/tasks/agg-p31-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2c9c1a1e6070980f457eab7c4b91f218f6f71d5 --- /dev/null +++ b/tasks/agg-p31-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82]' > "$answer" diff --git a/tasks/agg-p31-n12-s08/task.toml b/tasks/agg-p31-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e650db57ad1461e4b7b1709705168c80522292a5 --- /dev/null +++ b/tasks/agg-p31-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n12-s08/tests/expected.json b/tasks/agg-p31-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..271db4cf87fa353789878440febd8b5f48e7d8c2 --- /dev/null +++ b/tasks/agg-p31-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82] diff --git a/tasks/agg-p31-n12-s08/tests/test.sh b/tasks/agg-p31-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n12-s09/instruction.md b/tasks/agg-p31-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..afc44302e5446bbcbad60907a837f2fdde13fc15 --- /dev/null +++ b/tasks/agg-p31-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is two. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n12-s09/solution/solve.sh b/tasks/agg-p31-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2c9c1a1e6070980f457eab7c4b91f218f6f71d5 --- /dev/null +++ b/tasks/agg-p31-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82]' > "$answer" diff --git a/tasks/agg-p31-n12-s09/task.toml b/tasks/agg-p31-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..988f737cfd64a6b1e54977a905a95ca967cf8be8 --- /dev/null +++ b/tasks/agg-p31-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n12-s09/tests/expected.json b/tasks/agg-p31-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..271db4cf87fa353789878440febd8b5f48e7d8c2 --- /dev/null +++ b/tasks/agg-p31-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82] diff --git a/tasks/agg-p31-n12-s09/tests/test.sh b/tasks/agg-p31-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n12-s10/instruction.md b/tasks/agg-p31-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e2d2cc8e9bcc9cde703e8c6628f5b3a2b4377585 --- /dev/null +++ b/tasks/agg-p31-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n12-s10/solution/solve.sh b/tasks/agg-p31-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2c9c1a1e6070980f457eab7c4b91f218f6f71d5 --- /dev/null +++ b/tasks/agg-p31-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82]' > "$answer" diff --git a/tasks/agg-p31-n12-s10/task.toml b/tasks/agg-p31-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..07fbac1a1a0a9d46c2c4f86e13e324200fd68e4f --- /dev/null +++ b/tasks/agg-p31-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n12-s10/tests/expected.json b/tasks/agg-p31-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..271db4cf87fa353789878440febd8b5f48e7d8c2 --- /dev/null +++ b/tasks/agg-p31-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82] diff --git a/tasks/agg-p31-n12-s10/tests/test.sh b/tasks/agg-p31-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n12-s11/instruction.md b/tasks/agg-p31-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8bf4e335a22d725c98824995a69927ae729ffac4 --- /dev/null +++ b/tasks/agg-p31-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is twenty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n12-s11/solution/solve.sh b/tasks/agg-p31-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2c9c1a1e6070980f457eab7c4b91f218f6f71d5 --- /dev/null +++ b/tasks/agg-p31-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82]' > "$answer" diff --git a/tasks/agg-p31-n12-s11/task.toml b/tasks/agg-p31-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d1ef51ddca9ba490669efee6ca04ef03e59b3de4 --- /dev/null +++ b/tasks/agg-p31-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n12-s11/tests/expected.json b/tasks/agg-p31-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..271db4cf87fa353789878440febd8b5f48e7d8c2 --- /dev/null +++ b/tasks/agg-p31-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82] diff --git a/tasks/agg-p31-n12-s11/tests/test.sh b/tasks/agg-p31-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n12-s12/instruction.md b/tasks/agg-p31-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..15ed18a1ca8a56a1480af89c847dcd1fab959a55 --- /dev/null +++ b/tasks/agg-p31-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n12-s12/solution/solve.sh b/tasks/agg-p31-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..b2c9c1a1e6070980f457eab7c4b91f218f6f71d5 --- /dev/null +++ b/tasks/agg-p31-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82]' > "$answer" diff --git a/tasks/agg-p31-n12-s12/task.toml b/tasks/agg-p31-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d7d3e0c0e2a3e0a15e9c193445ad232fa60e38fd --- /dev/null +++ b/tasks/agg-p31-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p31-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 31 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p31-n12-s12/tests/expected.json b/tasks/agg-p31-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..271db4cf87fa353789878440febd8b5f48e7d8c2 --- /dev/null +++ b/tasks/agg-p31-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[2, 3, 4, 23, 25, 27, 28, 36, 39, 50, 51, 82] diff --git a/tasks/agg-p31-n12-s12/tests/test.sh b/tasks/agg-p31-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p31-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p31-n16-s01/instruction.md b/tasks/agg-p31-n16-s01/instruction.md index 04c3f6729149d2802728807768786a453bb32941..66fed180f5ece962b8f35828f82d008e1814560f 100644 --- a/tasks/agg-p31-n16-s01/instruction.md +++ b/tasks/agg-p31-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s01/tests/test.sh b/tasks/agg-p31-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s01/tests/test.sh +++ b/tasks/agg-p31-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s02/instruction.md b/tasks/agg-p31-n16-s02/instruction.md index 07133633c82ade16a43a26c7ec6cacc19d41b3bd..01eccecf7626f9336ce7f443b7b16b6f87314d4c 100644 --- a/tasks/agg-p31-n16-s02/instruction.md +++ b/tasks/agg-p31-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s02/tests/test.sh b/tasks/agg-p31-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s02/tests/test.sh +++ b/tasks/agg-p31-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s03/instruction.md b/tasks/agg-p31-n16-s03/instruction.md index 9137a4ab46a628c60be0b75972f0a9947e2c3883..4c327201eb92082d75247de85279b2149f069a49 100644 --- a/tasks/agg-p31-n16-s03/instruction.md +++ b/tasks/agg-p31-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s03/tests/test.sh b/tasks/agg-p31-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s03/tests/test.sh +++ b/tasks/agg-p31-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s04/instruction.md b/tasks/agg-p31-n16-s04/instruction.md index 552ad7b188277feadeb521fd17ec24a6f1f8f5ae..50bdd007515ead22fc5cdc1b26c44d0d9cdd48d1 100644 --- a/tasks/agg-p31-n16-s04/instruction.md +++ b/tasks/agg-p31-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s04/tests/test.sh b/tasks/agg-p31-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s04/tests/test.sh +++ b/tasks/agg-p31-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s05/instruction.md b/tasks/agg-p31-n16-s05/instruction.md index 8719f945164b6c7adba0eec9b9728be32d6bfe5e..10a630b21435ec8e620ae5e83c5dc41b678c1031 100644 --- a/tasks/agg-p31-n16-s05/instruction.md +++ b/tasks/agg-p31-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s05/tests/test.sh b/tasks/agg-p31-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s05/tests/test.sh +++ b/tasks/agg-p31-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s06/instruction.md b/tasks/agg-p31-n16-s06/instruction.md index 9dba8fcd9b2fce59a48316fb46a93570155cc398..fec7193f715ccf2092f0fe956e70ae778f0f8ae7 100644 --- a/tasks/agg-p31-n16-s06/instruction.md +++ b/tasks/agg-p31-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s06/tests/test.sh b/tasks/agg-p31-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s06/tests/test.sh +++ b/tasks/agg-p31-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s07/instruction.md b/tasks/agg-p31-n16-s07/instruction.md index fb03ade0279ecf776a2ba0e785bd133ee36ecac6..3a629248b9ad5c45b818dd2ecd91107928508549 100644 --- a/tasks/agg-p31-n16-s07/instruction.md +++ b/tasks/agg-p31-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s07/tests/test.sh b/tasks/agg-p31-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s07/tests/test.sh +++ b/tasks/agg-p31-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s08/instruction.md b/tasks/agg-p31-n16-s08/instruction.md index 635dd02b39036aac45824980be06065d4cdbba80..df537d63f89b272009aff77b78050806566e850d 100644 --- a/tasks/agg-p31-n16-s08/instruction.md +++ b/tasks/agg-p31-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s08/tests/test.sh b/tasks/agg-p31-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s08/tests/test.sh +++ b/tasks/agg-p31-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s09/instruction.md b/tasks/agg-p31-n16-s09/instruction.md index ebbf18dd1885eca56e4b99d9ba0f301603987c59..967cbe42235491e28138a2858f78709704a1bd82 100644 --- a/tasks/agg-p31-n16-s09/instruction.md +++ b/tasks/agg-p31-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s09/tests/test.sh b/tasks/agg-p31-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s09/tests/test.sh +++ b/tasks/agg-p31-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s10/instruction.md b/tasks/agg-p31-n16-s10/instruction.md index d443699990b373083b3fdeb1d846a400fde6e65b..b08879079fe0758b0792198b043d2a59e2a911e2 100644 --- a/tasks/agg-p31-n16-s10/instruction.md +++ b/tasks/agg-p31-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s10/tests/test.sh b/tasks/agg-p31-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s10/tests/test.sh +++ b/tasks/agg-p31-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s11/instruction.md b/tasks/agg-p31-n16-s11/instruction.md index d43b73fdfa99ecf2128fbcfe0de8040bb73fcb09..b12e192c283828cd14f2785cf454be268f90f5d0 100644 --- a/tasks/agg-p31-n16-s11/instruction.md +++ b/tasks/agg-p31-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s11/tests/test.sh b/tasks/agg-p31-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s11/tests/test.sh +++ b/tasks/agg-p31-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s12/instruction.md b/tasks/agg-p31-n16-s12/instruction.md index 24cae7506709ba17884a6f8faefcffb0fa372426..9945eb9052cf9160c89519b7d1952d5ce19dacf8 100644 --- a/tasks/agg-p31-n16-s12/instruction.md +++ b/tasks/agg-p31-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s12/tests/test.sh b/tasks/agg-p31-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s12/tests/test.sh +++ b/tasks/agg-p31-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s13/instruction.md b/tasks/agg-p31-n16-s13/instruction.md index 8e668cd99b85cf802939dffe8e766b769fcc702e..87e4a5f52a7382cfe533f0cb59ccf7425210c8fe 100644 --- a/tasks/agg-p31-n16-s13/instruction.md +++ b/tasks/agg-p31-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s13/tests/test.sh b/tasks/agg-p31-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s13/tests/test.sh +++ b/tasks/agg-p31-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s14/instruction.md b/tasks/agg-p31-n16-s14/instruction.md index 1fc02ff38c01961e6ef2d04b50e560edacdcca90..1d5113c5dd5abf3bbd4601fe16ab16e11d5a8b7c 100644 --- a/tasks/agg-p31-n16-s14/instruction.md +++ b/tasks/agg-p31-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s14/tests/test.sh b/tasks/agg-p31-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s14/tests/test.sh +++ b/tasks/agg-p31-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s15/instruction.md b/tasks/agg-p31-n16-s15/instruction.md index eec0889f35f181e3d5ee370338313f8afc894fe8..741d5c897d7dc6413c1bb96a8b00478c60c908ba 100644 --- a/tasks/agg-p31-n16-s15/instruction.md +++ b/tasks/agg-p31-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s15/tests/test.sh b/tasks/agg-p31-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s15/tests/test.sh +++ b/tasks/agg-p31-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p31-n16-s16/instruction.md b/tasks/agg-p31-n16-s16/instruction.md index 63a1a563a0b3abdd4e128d86f97d0a2fb0ea5c9e..7bc3e049121a5282217af4b5cf2ab2b62234a6ec 100644 --- a/tasks/agg-p31-n16-s16/instruction.md +++ b/tasks/agg-p31-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p31-n16-s16/tests/test.sh b/tasks/agg-p31-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p31-n16-s16/tests/test.sh +++ b/tasks/agg-p31-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n01-s01/instruction.md b/tasks/agg-p32-n01-s01/instruction.md index bdc1e7abd8c9a0ec54574a3ea55479587ff8ee18..0ba764f668820717a70f4cb7faf2b1cadddc9d32 100644 --- a/tasks/agg-p32-n01-s01/instruction.md +++ b/tasks/agg-p32-n01-s01/instruction.md @@ -6,4 +6,9 @@ hold one private integer from 1 to 99, written in English words. Your private number is sixty-five. Write `/app/answer.json` (create `/app` if needed): a JSON array holding your number's numeric -value, as digits. Then stop. +value, as digits. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the work phase before you submit, you will receive one final prompt to +submit your answer. diff --git a/tasks/agg-p32-n01-s01/tests/test.sh b/tasks/agg-p32-n01-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n01-s01/tests/test.sh +++ b/tasks/agg-p32-n01-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n02-s01/instruction.md b/tasks/agg-p32-n02-s01/instruction.md index 6ed04da681554d7be4b9aa9edcfd54a3e2bacf72..315b23a9f43b379f64e1430344b5f516c4d8c7d7 100644 --- a/tasks/agg-p32-n02-s01/instruction.md +++ b/tasks/agg-p32-n02-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n02-s01/tests/test.sh b/tasks/agg-p32-n02-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n02-s01/tests/test.sh +++ b/tasks/agg-p32-n02-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n02-s02/instruction.md b/tasks/agg-p32-n02-s02/instruction.md index 2ad688c099da13e670d8868f9320f6ec4c4014fd..701bb97c939a126cb3f07c685349d56af99e8bb5 100644 --- a/tasks/agg-p32-n02-s02/instruction.md +++ b/tasks/agg-p32-n02-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 2 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n02-s02/tests/test.sh b/tasks/agg-p32-n02-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n02-s02/tests/test.sh +++ b/tasks/agg-p32-n02-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n04-s01/instruction.md b/tasks/agg-p32-n04-s01/instruction.md index 10ac8a4eaab16f5c9d5a059aa13a56223f70be52..580537b716862c0c2a25f5061693e8c4ccbd726a 100644 --- a/tasks/agg-p32-n04-s01/instruction.md +++ b/tasks/agg-p32-n04-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n04-s01/tests/test.sh b/tasks/agg-p32-n04-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n04-s01/tests/test.sh +++ b/tasks/agg-p32-n04-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n04-s02/instruction.md b/tasks/agg-p32-n04-s02/instruction.md index 8084eea7e30d7dc232d655bd20c4cfd6e6fb6f29..393c539cf88256ff65d41794d6e1dde19660b072 100644 --- a/tasks/agg-p32-n04-s02/instruction.md +++ b/tasks/agg-p32-n04-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n04-s02/tests/test.sh b/tasks/agg-p32-n04-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n04-s02/tests/test.sh +++ b/tasks/agg-p32-n04-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n04-s03/instruction.md b/tasks/agg-p32-n04-s03/instruction.md index d0dfdb8971478a2127834dce630001bce8e7328c..8e32c04cab62402aa847cdee44a38b22a1633292 100644 --- a/tasks/agg-p32-n04-s03/instruction.md +++ b/tasks/agg-p32-n04-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n04-s03/tests/test.sh b/tasks/agg-p32-n04-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n04-s03/tests/test.sh +++ b/tasks/agg-p32-n04-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n04-s04/instruction.md b/tasks/agg-p32-n04-s04/instruction.md index 213f8f76a9f8395afe0c544ecd0e256b5d3a221a..2e3ad263c637a04b51ce9884664e8f02e6f0771c 100644 --- a/tasks/agg-p32-n04-s04/instruction.md +++ b/tasks/agg-p32-n04-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 4 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n04-s04/tests/test.sh b/tasks/agg-p32-n04-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n04-s04/tests/test.sh +++ b/tasks/agg-p32-n04-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n06-s01/instruction.md b/tasks/agg-p32-n06-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..87a186de4613802ff07f90a3ea674bd2076057bc --- /dev/null +++ b/tasks/agg-p32-n06-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n06-s01/solution/solve.sh b/tasks/agg-p32-n06-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f6f327b65bafe32627ca890120c65d6703962a9 --- /dev/null +++ b/tasks/agg-p32-n06-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[43, 61, 65, 80, 85, 86]' > "$answer" diff --git a/tasks/agg-p32-n06-s01/task.toml b/tasks/agg-p32-n06-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e5113bb6299e5961b06cc8581181b3626d2ceaa6 --- /dev/null +++ b/tasks/agg-p32-n06-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n06-s01" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 6 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n06-s01/tests/expected.json b/tasks/agg-p32-n06-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e0499a111a72c102ad3d259f0ea41f96a942a786 --- /dev/null +++ b/tasks/agg-p32-n06-s01/tests/expected.json @@ -0,0 +1 @@ +[43, 61, 65, 80, 85, 86] diff --git a/tasks/agg-p32-n06-s01/tests/test.sh b/tasks/agg-p32-n06-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n06-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n06-s02/instruction.md b/tasks/agg-p32-n06-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ac7c1a7396848e67068dcd3de2ace3ae734cf98a --- /dev/null +++ b/tasks/agg-p32-n06-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n06-s02/solution/solve.sh b/tasks/agg-p32-n06-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f6f327b65bafe32627ca890120c65d6703962a9 --- /dev/null +++ b/tasks/agg-p32-n06-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[43, 61, 65, 80, 85, 86]' > "$answer" diff --git a/tasks/agg-p32-n06-s02/task.toml b/tasks/agg-p32-n06-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e8dab1acd07a68a4526c83725eabdd8e1c7eeaaa --- /dev/null +++ b/tasks/agg-p32-n06-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n06-s02" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 6 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n06-s02/tests/expected.json b/tasks/agg-p32-n06-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e0499a111a72c102ad3d259f0ea41f96a942a786 --- /dev/null +++ b/tasks/agg-p32-n06-s02/tests/expected.json @@ -0,0 +1 @@ +[43, 61, 65, 80, 85, 86] diff --git a/tasks/agg-p32-n06-s02/tests/test.sh b/tasks/agg-p32-n06-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n06-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n06-s03/instruction.md b/tasks/agg-p32-n06-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..31899d656ba6c4fe261671ef0578d92635262d78 --- /dev/null +++ b/tasks/agg-p32-n06-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-five. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n06-s03/solution/solve.sh b/tasks/agg-p32-n06-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f6f327b65bafe32627ca890120c65d6703962a9 --- /dev/null +++ b/tasks/agg-p32-n06-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[43, 61, 65, 80, 85, 86]' > "$answer" diff --git a/tasks/agg-p32-n06-s03/task.toml b/tasks/agg-p32-n06-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bdf70b87e3af172fcfd244e8e0cadb8489bc20c0 --- /dev/null +++ b/tasks/agg-p32-n06-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n06-s03" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 6 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n06-s03/tests/expected.json b/tasks/agg-p32-n06-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e0499a111a72c102ad3d259f0ea41f96a942a786 --- /dev/null +++ b/tasks/agg-p32-n06-s03/tests/expected.json @@ -0,0 +1 @@ +[43, 61, 65, 80, 85, 86] diff --git a/tasks/agg-p32-n06-s03/tests/test.sh b/tasks/agg-p32-n06-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n06-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n06-s04/instruction.md b/tasks/agg-p32-n06-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bc2345670eef592df5089b3576aa387d4b4f7ef0 --- /dev/null +++ b/tasks/agg-p32-n06-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n06-s04/solution/solve.sh b/tasks/agg-p32-n06-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f6f327b65bafe32627ca890120c65d6703962a9 --- /dev/null +++ b/tasks/agg-p32-n06-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[43, 61, 65, 80, 85, 86]' > "$answer" diff --git a/tasks/agg-p32-n06-s04/task.toml b/tasks/agg-p32-n06-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..05668fe926d5346c001119038c07a975401aa633 --- /dev/null +++ b/tasks/agg-p32-n06-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n06-s04" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 6 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n06-s04/tests/expected.json b/tasks/agg-p32-n06-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e0499a111a72c102ad3d259f0ea41f96a942a786 --- /dev/null +++ b/tasks/agg-p32-n06-s04/tests/expected.json @@ -0,0 +1 @@ +[43, 61, 65, 80, 85, 86] diff --git a/tasks/agg-p32-n06-s04/tests/test.sh b/tasks/agg-p32-n06-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n06-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n06-s05/instruction.md b/tasks/agg-p32-n06-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7de047c5dfa2d2d4687c682be1e69dda63d15edb --- /dev/null +++ b/tasks/agg-p32-n06-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-six. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n06-s05/solution/solve.sh b/tasks/agg-p32-n06-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f6f327b65bafe32627ca890120c65d6703962a9 --- /dev/null +++ b/tasks/agg-p32-n06-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[43, 61, 65, 80, 85, 86]' > "$answer" diff --git a/tasks/agg-p32-n06-s05/task.toml b/tasks/agg-p32-n06-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..63497dce5b71bcacc07bb5503ba49a162d02a99e --- /dev/null +++ b/tasks/agg-p32-n06-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n06-s05" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 6 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n06-s05/tests/expected.json b/tasks/agg-p32-n06-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e0499a111a72c102ad3d259f0ea41f96a942a786 --- /dev/null +++ b/tasks/agg-p32-n06-s05/tests/expected.json @@ -0,0 +1 @@ +[43, 61, 65, 80, 85, 86] diff --git a/tasks/agg-p32-n06-s05/tests/test.sh b/tasks/agg-p32-n06-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n06-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n06-s06/instruction.md b/tasks/agg-p32-n06-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..051446d50cd8d4de68bb620c5ed19ced7da11cab --- /dev/null +++ b/tasks/agg-p32-n06-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 6 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-one. + +The team must find all 6 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 6 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n06-s06/solution/solve.sh b/tasks/agg-p32-n06-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..7f6f327b65bafe32627ca890120c65d6703962a9 --- /dev/null +++ b/tasks/agg-p32-n06-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[43, 61, 65, 80, 85, 86]' > "$answer" diff --git a/tasks/agg-p32-n06-s06/task.toml b/tasks/agg-p32-n06-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8df3b5af699af0a3f181d773e9ebfdf326a4757c --- /dev/null +++ b/tasks/agg-p32-n06-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n06-s06" +version = "0.1.0" +description = "s3-aggregation: 6 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 6 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n06-s06/tests/expected.json b/tasks/agg-p32-n06-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..e0499a111a72c102ad3d259f0ea41f96a942a786 --- /dev/null +++ b/tasks/agg-p32-n06-s06/tests/expected.json @@ -0,0 +1 @@ +[43, 61, 65, 80, 85, 86] diff --git a/tasks/agg-p32-n06-s06/tests/test.sh b/tasks/agg-p32-n06-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n06-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n08-s01/instruction.md b/tasks/agg-p32-n08-s01/instruction.md index e5a9078e4c58d734bc89d35a1a10f88352728538..39e243af8207cc8b7adc554fc5ac12d75cb1895b 100644 --- a/tasks/agg-p32-n08-s01/instruction.md +++ b/tasks/agg-p32-n08-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n08-s01/tests/test.sh b/tasks/agg-p32-n08-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n08-s01/tests/test.sh +++ b/tasks/agg-p32-n08-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n08-s02/instruction.md b/tasks/agg-p32-n08-s02/instruction.md index 0159511c6cffd8cd49c7d4dcefc8c70d490860a0..9323dbff8a3c81fa902978c6fddec64963353aa0 100644 --- a/tasks/agg-p32-n08-s02/instruction.md +++ b/tasks/agg-p32-n08-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n08-s02/tests/test.sh b/tasks/agg-p32-n08-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n08-s02/tests/test.sh +++ b/tasks/agg-p32-n08-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n08-s03/instruction.md b/tasks/agg-p32-n08-s03/instruction.md index 69ba917f6c6eae1a89454fec3af62dc26ea478c0..9af8abd7186a7fe77f443e5f122b33c758dcbca6 100644 --- a/tasks/agg-p32-n08-s03/instruction.md +++ b/tasks/agg-p32-n08-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n08-s03/tests/test.sh b/tasks/agg-p32-n08-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n08-s03/tests/test.sh +++ b/tasks/agg-p32-n08-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n08-s04/instruction.md b/tasks/agg-p32-n08-s04/instruction.md index 2c724ce2f54c8829b6d803659e7e96973259720e..162682e2e51553326a61ee7f19eafb58e7dcde79 100644 --- a/tasks/agg-p32-n08-s04/instruction.md +++ b/tasks/agg-p32-n08-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n08-s04/tests/test.sh b/tasks/agg-p32-n08-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n08-s04/tests/test.sh +++ b/tasks/agg-p32-n08-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n08-s05/instruction.md b/tasks/agg-p32-n08-s05/instruction.md index 886bc72662ab9eb339369a28cc3322cfbb3eaa89..b408160ded02b305a1041d2ca3291e96767416f1 100644 --- a/tasks/agg-p32-n08-s05/instruction.md +++ b/tasks/agg-p32-n08-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n08-s05/tests/test.sh b/tasks/agg-p32-n08-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n08-s05/tests/test.sh +++ b/tasks/agg-p32-n08-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n08-s06/instruction.md b/tasks/agg-p32-n08-s06/instruction.md index 40f9146550b33cf06b1d4200b62a15ddaaffce76..88319c076939435d4dc23a2c973a6a077628ef17 100644 --- a/tasks/agg-p32-n08-s06/instruction.md +++ b/tasks/agg-p32-n08-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n08-s06/tests/test.sh b/tasks/agg-p32-n08-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n08-s06/tests/test.sh +++ b/tasks/agg-p32-n08-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n08-s07/instruction.md b/tasks/agg-p32-n08-s07/instruction.md index e62126a64149a24e7278e73a216c4b232e5a78b2..b71e2424ef5ce0937a35b4ebd2df423d133331cc 100644 --- a/tasks/agg-p32-n08-s07/instruction.md +++ b/tasks/agg-p32-n08-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n08-s07/tests/test.sh b/tasks/agg-p32-n08-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n08-s07/tests/test.sh +++ b/tasks/agg-p32-n08-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n08-s08/instruction.md b/tasks/agg-p32-n08-s08/instruction.md index 3ef2ec7b4ffc263c27c3bece987fc632ef3cc457..bb55200f8e9216811174b4f1ef5eacfa2a976d3e 100644 --- a/tasks/agg-p32-n08-s08/instruction.md +++ b/tasks/agg-p32-n08-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 8 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n08-s08/tests/test.sh b/tasks/agg-p32-n08-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n08-s08/tests/test.sh +++ b/tasks/agg-p32-n08-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n12-s01/instruction.md b/tasks/agg-p32-n12-s01/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9d09fce34dd764ef615193ac1a5121b1d8ac297a --- /dev/null +++ b/tasks/agg-p32-n12-s01/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n12-s01/solution/solve.sh b/tasks/agg-p32-n12-s01/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8109e3a6cb50fa864bc5f7f02508afe4472a1102 --- /dev/null +++ b/tasks/agg-p32-n12-s01/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89]' > "$answer" diff --git a/tasks/agg-p32-n12-s01/task.toml b/tasks/agg-p32-n12-s01/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c1d72cf34fae95e09bf24922f46b9c09ac8623db --- /dev/null +++ b/tasks/agg-p32-n12-s01/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n12-s01" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 12 +slot = 1 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n12-s01/tests/expected.json b/tasks/agg-p32-n12-s01/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c47fbc291789bc9017481110202e71a361a2eec8 --- /dev/null +++ b/tasks/agg-p32-n12-s01/tests/expected.json @@ -0,0 +1 @@ +[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89] diff --git a/tasks/agg-p32-n12-s01/tests/test.sh b/tasks/agg-p32-n12-s01/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n12-s01/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n12-s02/instruction.md b/tasks/agg-p32-n12-s02/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0638ca5d6aa951738816bc0a27d1ad8471c74799 --- /dev/null +++ b/tasks/agg-p32-n12-s02/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n12-s02/solution/solve.sh b/tasks/agg-p32-n12-s02/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8109e3a6cb50fa864bc5f7f02508afe4472a1102 --- /dev/null +++ b/tasks/agg-p32-n12-s02/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89]' > "$answer" diff --git a/tasks/agg-p32-n12-s02/task.toml b/tasks/agg-p32-n12-s02/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8931eaefd30967bc3b25913906a0cef368d44b0f --- /dev/null +++ b/tasks/agg-p32-n12-s02/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n12-s02" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 12 +slot = 2 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n12-s02/tests/expected.json b/tasks/agg-p32-n12-s02/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c47fbc291789bc9017481110202e71a361a2eec8 --- /dev/null +++ b/tasks/agg-p32-n12-s02/tests/expected.json @@ -0,0 +1 @@ +[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89] diff --git a/tasks/agg-p32-n12-s02/tests/test.sh b/tasks/agg-p32-n12-s02/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n12-s02/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n12-s03/instruction.md b/tasks/agg-p32-n12-s03/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..92a22d6cf9a7e49a077d762bec35bc485b2caf87 --- /dev/null +++ b/tasks/agg-p32-n12-s03/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n12-s03/solution/solve.sh b/tasks/agg-p32-n12-s03/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8109e3a6cb50fa864bc5f7f02508afe4472a1102 --- /dev/null +++ b/tasks/agg-p32-n12-s03/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89]' > "$answer" diff --git a/tasks/agg-p32-n12-s03/task.toml b/tasks/agg-p32-n12-s03/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e1173efb5b8cb2dc4572204a0fd927813f581465 --- /dev/null +++ b/tasks/agg-p32-n12-s03/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n12-s03" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 12 +slot = 3 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n12-s03/tests/expected.json b/tasks/agg-p32-n12-s03/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c47fbc291789bc9017481110202e71a361a2eec8 --- /dev/null +++ b/tasks/agg-p32-n12-s03/tests/expected.json @@ -0,0 +1 @@ +[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89] diff --git a/tasks/agg-p32-n12-s03/tests/test.sh b/tasks/agg-p32-n12-s03/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n12-s03/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n12-s04/instruction.md b/tasks/agg-p32-n12-s04/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..894c08d452dd150a471307a3b982c78b62f7152f --- /dev/null +++ b/tasks/agg-p32-n12-s04/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is forty-three. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n12-s04/solution/solve.sh b/tasks/agg-p32-n12-s04/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8109e3a6cb50fa864bc5f7f02508afe4472a1102 --- /dev/null +++ b/tasks/agg-p32-n12-s04/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89]' > "$answer" diff --git a/tasks/agg-p32-n12-s04/task.toml b/tasks/agg-p32-n12-s04/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b9b4d035d6d3edcfab76fb041e2dda2ab46e6433 --- /dev/null +++ b/tasks/agg-p32-n12-s04/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n12-s04" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 12 +slot = 4 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n12-s04/tests/expected.json b/tasks/agg-p32-n12-s04/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c47fbc291789bc9017481110202e71a361a2eec8 --- /dev/null +++ b/tasks/agg-p32-n12-s04/tests/expected.json @@ -0,0 +1 @@ +[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89] diff --git a/tasks/agg-p32-n12-s04/tests/test.sh b/tasks/agg-p32-n12-s04/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n12-s04/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n12-s05/instruction.md b/tasks/agg-p32-n12-s05/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..71e4b46f8ef6c0e175e49cbd3404e539262eb6fd --- /dev/null +++ b/tasks/agg-p32-n12-s05/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n12-s05/solution/solve.sh b/tasks/agg-p32-n12-s05/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8109e3a6cb50fa864bc5f7f02508afe4472a1102 --- /dev/null +++ b/tasks/agg-p32-n12-s05/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89]' > "$answer" diff --git a/tasks/agg-p32-n12-s05/task.toml b/tasks/agg-p32-n12-s05/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2db321e907c74004b1e0a89c6981118d4e3b9b1f --- /dev/null +++ b/tasks/agg-p32-n12-s05/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n12-s05" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 12 +slot = 5 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n12-s05/tests/expected.json b/tasks/agg-p32-n12-s05/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c47fbc291789bc9017481110202e71a361a2eec8 --- /dev/null +++ b/tasks/agg-p32-n12-s05/tests/expected.json @@ -0,0 +1 @@ +[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89] diff --git a/tasks/agg-p32-n12-s05/tests/test.sh b/tasks/agg-p32-n12-s05/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n12-s05/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n12-s06/instruction.md b/tasks/agg-p32-n12-s06/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b23cc64451ba67760e7585b5affddf553a657ad0 --- /dev/null +++ b/tasks/agg-p32-n12-s06/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n12-s06/solution/solve.sh b/tasks/agg-p32-n12-s06/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8109e3a6cb50fa864bc5f7f02508afe4472a1102 --- /dev/null +++ b/tasks/agg-p32-n12-s06/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89]' > "$answer" diff --git a/tasks/agg-p32-n12-s06/task.toml b/tasks/agg-p32-n12-s06/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2c95f4b5b0af4c064f32c329f3b7ca31ce2b5df5 --- /dev/null +++ b/tasks/agg-p32-n12-s06/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n12-s06" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 12 +slot = 6 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n12-s06/tests/expected.json b/tasks/agg-p32-n12-s06/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c47fbc291789bc9017481110202e71a361a2eec8 --- /dev/null +++ b/tasks/agg-p32-n12-s06/tests/expected.json @@ -0,0 +1 @@ +[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89] diff --git a/tasks/agg-p32-n12-s06/tests/test.sh b/tasks/agg-p32-n12-s06/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n12-s06/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n12-s07/instruction.md b/tasks/agg-p32-n12-s07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8b047c78be8ec74c45258c089b61fd8c92d01be1 --- /dev/null +++ b/tasks/agg-p32-n12-s07/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is fifty-eight. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n12-s07/solution/solve.sh b/tasks/agg-p32-n12-s07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8109e3a6cb50fa864bc5f7f02508afe4472a1102 --- /dev/null +++ b/tasks/agg-p32-n12-s07/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89]' > "$answer" diff --git a/tasks/agg-p32-n12-s07/task.toml b/tasks/agg-p32-n12-s07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c2488f8515f98b2b79396bf02f188ede5352e546 --- /dev/null +++ b/tasks/agg-p32-n12-s07/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n12-s07" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 12 +slot = 7 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n12-s07/tests/expected.json b/tasks/agg-p32-n12-s07/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c47fbc291789bc9017481110202e71a361a2eec8 --- /dev/null +++ b/tasks/agg-p32-n12-s07/tests/expected.json @@ -0,0 +1 @@ +[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89] diff --git a/tasks/agg-p32-n12-s07/tests/test.sh b/tasks/agg-p32-n12-s07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n12-s07/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n12-s08/instruction.md b/tasks/agg-p32-n12-s08/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0409dcf29dd269b54d93ca84f2b9a827d9cf7d50 --- /dev/null +++ b/tasks/agg-p32-n12-s08/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is eighty-nine. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n12-s08/solution/solve.sh b/tasks/agg-p32-n12-s08/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8109e3a6cb50fa864bc5f7f02508afe4472a1102 --- /dev/null +++ b/tasks/agg-p32-n12-s08/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89]' > "$answer" diff --git a/tasks/agg-p32-n12-s08/task.toml b/tasks/agg-p32-n12-s08/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f71fa0136a616def0802c552ee8df8b16040b9bb --- /dev/null +++ b/tasks/agg-p32-n12-s08/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n12-s08" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 12 +slot = 8 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n12-s08/tests/expected.json b/tasks/agg-p32-n12-s08/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c47fbc291789bc9017481110202e71a361a2eec8 --- /dev/null +++ b/tasks/agg-p32-n12-s08/tests/expected.json @@ -0,0 +1 @@ +[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89] diff --git a/tasks/agg-p32-n12-s08/tests/test.sh b/tasks/agg-p32-n12-s08/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n12-s08/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n12-s09/instruction.md b/tasks/agg-p32-n12-s09/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9d09fce34dd764ef615193ac1a5121b1d8ac297a --- /dev/null +++ b/tasks/agg-p32-n12-s09/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-five. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n12-s09/solution/solve.sh b/tasks/agg-p32-n12-s09/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8109e3a6cb50fa864bc5f7f02508afe4472a1102 --- /dev/null +++ b/tasks/agg-p32-n12-s09/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89]' > "$answer" diff --git a/tasks/agg-p32-n12-s09/task.toml b/tasks/agg-p32-n12-s09/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3400b3d64d3ff7b81d86ee0e286498e8bcdb141b --- /dev/null +++ b/tasks/agg-p32-n12-s09/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n12-s09" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 12 +slot = 9 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n12-s09/tests/expected.json b/tasks/agg-p32-n12-s09/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c47fbc291789bc9017481110202e71a361a2eec8 --- /dev/null +++ b/tasks/agg-p32-n12-s09/tests/expected.json @@ -0,0 +1 @@ +[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89] diff --git a/tasks/agg-p32-n12-s09/tests/test.sh b/tasks/agg-p32-n12-s09/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n12-s09/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n12-s10/instruction.md b/tasks/agg-p32-n12-s10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..55211891d2eae86ad815f2101b3fba33c6a19886 --- /dev/null +++ b/tasks/agg-p32-n12-s10/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is seventy-six. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n12-s10/solution/solve.sh b/tasks/agg-p32-n12-s10/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8109e3a6cb50fa864bc5f7f02508afe4472a1102 --- /dev/null +++ b/tasks/agg-p32-n12-s10/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89]' > "$answer" diff --git a/tasks/agg-p32-n12-s10/task.toml b/tasks/agg-p32-n12-s10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..39940358b4c96cce76df6ed16bdec7bedd5a8ac9 --- /dev/null +++ b/tasks/agg-p32-n12-s10/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n12-s10" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 12 +slot = 10 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n12-s10/tests/expected.json b/tasks/agg-p32-n12-s10/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c47fbc291789bc9017481110202e71a361a2eec8 --- /dev/null +++ b/tasks/agg-p32-n12-s10/tests/expected.json @@ -0,0 +1 @@ +[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89] diff --git a/tasks/agg-p32-n12-s10/tests/test.sh b/tasks/agg-p32-n12-s10/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n12-s10/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n12-s11/instruction.md b/tasks/agg-p32-n12-s11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5435b7812ef266a4e2ec6b0a93d3c306439294ba --- /dev/null +++ b/tasks/agg-p32-n12-s11/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is thirty-one. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n12-s11/solution/solve.sh b/tasks/agg-p32-n12-s11/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8109e3a6cb50fa864bc5f7f02508afe4472a1102 --- /dev/null +++ b/tasks/agg-p32-n12-s11/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89]' > "$answer" diff --git a/tasks/agg-p32-n12-s11/task.toml b/tasks/agg-p32-n12-s11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..05c32c61ba0c9743996187cbc0ff0e56e673b27e --- /dev/null +++ b/tasks/agg-p32-n12-s11/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n12-s11" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 12 +slot = 11 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n12-s11/tests/expected.json b/tasks/agg-p32-n12-s11/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c47fbc291789bc9017481110202e71a361a2eec8 --- /dev/null +++ b/tasks/agg-p32-n12-s11/tests/expected.json @@ -0,0 +1 @@ +[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89] diff --git a/tasks/agg-p32-n12-s11/tests/test.sh b/tasks/agg-p32-n12-s11/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n12-s11/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n12-s12/instruction.md b/tasks/agg-p32-n12-s12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ac0fb3589d74cb9ec090d7919df303360b87a4cd --- /dev/null +++ b/tasks/agg-p32-n12-s12/instruction.md @@ -0,0 +1,25 @@ +# Sort the team's private numbers + +You are on a team of 12 agents solving a private-information number sorting task. Each agent +holds one private integer from 1 to 99, written in English words. You know only your own +number, and the others don't know it unless you tell them. + +Your private number is sixty-seven. + +The team must find all 12 numbers and list their numeric values in ascending order. Keep equal +numbers from different agents as separate entries: each agent's number appears once in the list, +even when another agent holds the same value. + +1. Share your number with the team on the message board. +2. Read the board for the other participants' numbers. Note which participant each number came + from, so that a number posted more than once is counted once. +3. Once you have one number from every participant, yourself included, write `/app/answer.json` + (create `/app` if needed): a JSON array of the 12 integers, as digits, in ascending order. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. + +Any agent may write the full answer, and the team succeeds if at least one agent's answer is +correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n12-s12/solution/solve.sh b/tasks/agg-p32-n12-s12/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..8109e3a6cb50fa864bc5f7f02508afe4472a1102 --- /dev/null +++ b/tasks/agg-p32-n12-s12/solution/solve.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Oracle: the team's answer from its own copy (not tests/), to validate the grader. +answer=${ANSWER:-/app/answer.json} +mkdir -p "$(dirname "$answer")" +echo '[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89]' > "$answer" diff --git a/tasks/agg-p32-n12-s12/task.toml b/tasks/agg-p32-n12-s12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..191b9f3244f2eead99b70212f0304c3176590b56 --- /dev/null +++ b/tasks/agg-p32-n12-s12/task.toml @@ -0,0 +1,27 @@ +schema_version = "1.4" + +[task] +name = "HuggingFaceSwarms/agg-p32-n12-s12" +version = "0.1.0" +description = "s3-aggregation: 12 agents each hold a private number; the team lists them all in ascending order." +keywords = ["multi-agent", "message-board", "s3", "aggregation"] + +[metadata] +problem = 32 +agents = 12 +slot = 12 +seed = 115 + +[agent] +timeout_sec = 1800 + +[environment] +# Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it +# too. Nothing task-specific is in the container: the slot's number is only in its instruction, +# and tests/ arrive only when the agent is done. +docker_image = "python:3.12-slim" +cpus = 1 +memory_mb = 1024 + +[verifier] +timeout_sec = 60 diff --git a/tasks/agg-p32-n12-s12/tests/expected.json b/tasks/agg-p32-n12-s12/tests/expected.json new file mode 100644 index 0000000000000000000000000000000000000000..c47fbc291789bc9017481110202e71a361a2eec8 --- /dev/null +++ b/tasks/agg-p32-n12-s12/tests/expected.json @@ -0,0 +1 @@ +[31, 43, 58, 61, 65, 65, 67, 76, 80, 85, 86, 89] diff --git a/tasks/agg-p32-n12-s12/tests/test.sh b/tasks/agg-p32-n12-s12/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 --- /dev/null +++ b/tasks/agg-p32-n12-s12/tests/test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in +# ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or +# unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or +# booleans, a missing, extra or dropped duplicate number, and a wrong order. +# The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to +# /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app), +# a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here +# follows a link the agent may have left, and 0 is written before anything is checked, so a crash +# of the check also scores 0. A copy of the answer stays with the trial's results. +# Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the +# user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what +# it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or +# rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths +# (no links in them), to test the grader locally. +case $0 in */*) here=${0%/*} ;; *) here=. ;; esac +export ANSWER=${ANSWER:-/app/answer.json} +export EXPECTED=${EXPECTED:-$here/expected.json} +export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +python3 -I -S - <<'PY' || true +import json +import os +import stat + +LIMIT = 1 << 20 # bytes + + +def read_own(path): + # The bytes of the regular file at exactly `path`: every folder on the way is opened + # without following a link, and so is the file (a FIFO cannot block it); one link only. + parts = os.path.abspath(path).split("/")[1:] + folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + for part in parts[:-1]: + inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder) + os.close(folder) + folder = inner + fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder) + finally: + os.close(folder) + with os.fdopen(fd, "rb") as stream: + info = os.fstat(stream.fileno()) + if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1: + raise ValueError("not a regular file of its own") + data = stream.read(LIMIT + 1) + if len(data) > LIMIT: + raise ValueError("too large") + return data + + +def write_new(path, text): + fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644) + with os.fdopen(fd, "w") as stream: + stream.write(text) + + +def reject_constant(name): + raise ValueError(f"{name} is not JSON") + + +def parse(data): + return json.loads(data.decode("utf-8"), parse_constant=reject_constant) + + +verifier = os.environ["VERIFIER_DIR"] +os.makedirs(verifier, exist_ok=True) +for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link + try: + os.unlink(os.path.join(verifier, name)) + except FileNotFoundError: + pass +write_new(os.path.join(verifier, "reward.txt"), "0") +valid = False +try: + data = read_own(os.environ["ANSWER"]) + write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace")) + answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"])) + valid = ( + isinstance(answer, list) + and all(type(x) is int for x in answer) # not bool, float or str + and answer == expected + ) +except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError + valid = False +if valid: + write_new(os.path.join(verifier, "reward.txt"), "1") +print("reward:", 1 if valid else 0) +PY diff --git a/tasks/agg-p32-n16-s01/instruction.md b/tasks/agg-p32-n16-s01/instruction.md index c9f61576dcb8ea2769bc6b953c327b5baba2bb54..728715ff5a180904d17bdd4c6d3921ea7a2eb170 100644 --- a/tasks/agg-p32-n16-s01/instruction.md +++ b/tasks/agg-p32-n16-s01/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s01/tests/test.sh b/tasks/agg-p32-n16-s01/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s01/tests/test.sh +++ b/tasks/agg-p32-n16-s01/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s02/instruction.md b/tasks/agg-p32-n16-s02/instruction.md index 20368eea0e489e69957687bad213a18453b76098..8f9bad3938d44e9bca82af86d41dae7581f5b0b3 100644 --- a/tasks/agg-p32-n16-s02/instruction.md +++ b/tasks/agg-p32-n16-s02/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s02/tests/test.sh b/tasks/agg-p32-n16-s02/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s02/tests/test.sh +++ b/tasks/agg-p32-n16-s02/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s03/instruction.md b/tasks/agg-p32-n16-s03/instruction.md index a74f85b07c6b9158e3042c827fbada79d595e8f5..364d02befda9eef167acd079029967edd1989d2b 100644 --- a/tasks/agg-p32-n16-s03/instruction.md +++ b/tasks/agg-p32-n16-s03/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s03/tests/test.sh b/tasks/agg-p32-n16-s03/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s03/tests/test.sh +++ b/tasks/agg-p32-n16-s03/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s04/instruction.md b/tasks/agg-p32-n16-s04/instruction.md index c0f9d178a1c3057c8c4b57e9c5eca4e4c625b138..efa987bc861271d3fcd4cc6f1530e4d2ecbb6990 100644 --- a/tasks/agg-p32-n16-s04/instruction.md +++ b/tasks/agg-p32-n16-s04/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s04/tests/test.sh b/tasks/agg-p32-n16-s04/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s04/tests/test.sh +++ b/tasks/agg-p32-n16-s04/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s05/instruction.md b/tasks/agg-p32-n16-s05/instruction.md index 07c9e57a88a9821b15aef8e576670581ef52b8cf..f17e7c1550785116b92d6c8da78aeb05d8edf6c0 100644 --- a/tasks/agg-p32-n16-s05/instruction.md +++ b/tasks/agg-p32-n16-s05/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s05/tests/test.sh b/tasks/agg-p32-n16-s05/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s05/tests/test.sh +++ b/tasks/agg-p32-n16-s05/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s06/instruction.md b/tasks/agg-p32-n16-s06/instruction.md index 72bbb260a72c8a03816a7f046d2bafe5f6b145f2..fe4f0325e372e3a12281df6aa7a7ff5ffc6e5d94 100644 --- a/tasks/agg-p32-n16-s06/instruction.md +++ b/tasks/agg-p32-n16-s06/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s06/tests/test.sh b/tasks/agg-p32-n16-s06/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s06/tests/test.sh +++ b/tasks/agg-p32-n16-s06/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s07/instruction.md b/tasks/agg-p32-n16-s07/instruction.md index e5c784e3be1e3c1c8c8931ac55ae2345c1d7e341..0132dbcb468155a843c8c2b7a4a9e6ca2be0c499 100644 --- a/tasks/agg-p32-n16-s07/instruction.md +++ b/tasks/agg-p32-n16-s07/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s07/tests/test.sh b/tasks/agg-p32-n16-s07/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s07/tests/test.sh +++ b/tasks/agg-p32-n16-s07/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s08/instruction.md b/tasks/agg-p32-n16-s08/instruction.md index 33c6e5250952f3077456a896c57a642ebd1c8d39..2ed4d1a65ed8a6a1ef17afdd17d82926d08e7770 100644 --- a/tasks/agg-p32-n16-s08/instruction.md +++ b/tasks/agg-p32-n16-s08/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s08/tests/test.sh b/tasks/agg-p32-n16-s08/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s08/tests/test.sh +++ b/tasks/agg-p32-n16-s08/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s09/instruction.md b/tasks/agg-p32-n16-s09/instruction.md index c9f61576dcb8ea2769bc6b953c327b5baba2bb54..728715ff5a180904d17bdd4c6d3921ea7a2eb170 100644 --- a/tasks/agg-p32-n16-s09/instruction.md +++ b/tasks/agg-p32-n16-s09/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s09/tests/test.sh b/tasks/agg-p32-n16-s09/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s09/tests/test.sh +++ b/tasks/agg-p32-n16-s09/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s10/instruction.md b/tasks/agg-p32-n16-s10/instruction.md index 1fc02ff38c01961e6ef2d04b50e560edacdcca90..1d5113c5dd5abf3bbd4601fe16ab16e11d5a8b7c 100644 --- a/tasks/agg-p32-n16-s10/instruction.md +++ b/tasks/agg-p32-n16-s10/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s10/tests/test.sh b/tasks/agg-p32-n16-s10/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s10/tests/test.sh +++ b/tasks/agg-p32-n16-s10/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s11/instruction.md b/tasks/agg-p32-n16-s11/instruction.md index 1245386f0aba38aec1627364e9a0bdce0b3a3214..7a6abd7e671d0d5e514cf3a081a12822f3e1fa80 100644 --- a/tasks/agg-p32-n16-s11/instruction.md +++ b/tasks/agg-p32-n16-s11/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s11/tests/test.sh b/tasks/agg-p32-n16-s11/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s11/tests/test.sh +++ b/tasks/agg-p32-n16-s11/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s12/instruction.md b/tasks/agg-p32-n16-s12/instruction.md index cebfaeb748131e1409dea8040dd71bd8744f230b..f855e374529122b9a74995c685bdc0845b660076 100644 --- a/tasks/agg-p32-n16-s12/instruction.md +++ b/tasks/agg-p32-n16-s12/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s12/tests/test.sh b/tasks/agg-p32-n16-s12/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s12/tests/test.sh +++ b/tasks/agg-p32-n16-s12/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s13/instruction.md b/tasks/agg-p32-n16-s13/instruction.md index 99a7f97eb2774bf91fcf02fc9e18c71f2c746d9d..b0c86232070beace6f6b66df51114731c8869870 100644 --- a/tasks/agg-p32-n16-s13/instruction.md +++ b/tasks/agg-p32-n16-s13/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s13/tests/test.sh b/tasks/agg-p32-n16-s13/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s13/tests/test.sh +++ b/tasks/agg-p32-n16-s13/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s14/instruction.md b/tasks/agg-p32-n16-s14/instruction.md index e6525541e28785999ae8d5c02f6d6d23b361a5d0..227291817b4e694dd8c40dd180dd732a5a0be188 100644 --- a/tasks/agg-p32-n16-s14/instruction.md +++ b/tasks/agg-p32-n16-s14/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s14/tests/test.sh b/tasks/agg-p32-n16-s14/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s14/tests/test.sh +++ b/tasks/agg-p32-n16-s14/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s15/instruction.md b/tasks/agg-p32-n16-s15/instruction.md index e6525541e28785999ae8d5c02f6d6d23b361a5d0..227291817b4e694dd8c40dd180dd732a5a0be188 100644 --- a/tasks/agg-p32-n16-s15/instruction.md +++ b/tasks/agg-p32-n16-s15/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s15/tests/test.sh b/tasks/agg-p32-n16-s15/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s15/tests/test.sh +++ b/tasks/agg-p32-n16-s15/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os diff --git a/tasks/agg-p32-n16-s16/instruction.md b/tasks/agg-p32-n16-s16/instruction.md index 756b66e7e1661b13390451604d8a217c6028d32d..0d5d43f3e734b37862973953434a82fefb583200 100644 --- a/tasks/agg-p32-n16-s16/instruction.md +++ b/tasks/agg-p32-n16-s16/instruction.md @@ -15,7 +15,11 @@ even when another agent holds the same value. from, so that a number posted more than once is counted once. 3. Once you have one number from every participant, yourself included, write `/app/answer.json` (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order. - Then stop. + +`/app/answer.json` is your single final submission. Do not write a draft there or overwrite +it. Write it once when you are ready to submit, then stop immediately. +If the runner ends the messaging phase before you submit, you will receive one final prompt. +Use it to submit your best answer. Any agent may write the full answer, and the team succeeds if at least one agent's answer is correct. Your instructions name the other participants and explain the board's tools. diff --git a/tasks/agg-p32-n16-s16/tests/test.sh b/tasks/agg-p32-n16-s16/tests/test.sh index 86b31a5d42a2b1c345b6e2db0e8167bb5c077ed9..7a05a96ab6d06eeb0bd9e4bb66da149fe2439306 100644 --- a/tasks/agg-p32-n16-s16/tests/test.sh +++ b/tasks/agg-p32-n16-s16/tests/test.sh @@ -17,7 +17,7 @@ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac export ANSWER=${ANSWER:-/app/answer.json} export EXPECTED=${EXPECTED:-$here/expected.json} export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier} -[ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt" +[ -d "$VERIFIER_DIR" ] && [ ! -L "$VERIFIER_DIR/reward.txt" ] && echo 0 > "$VERIFIER_DIR/reward.txt" python3 -I -S - <<'PY' || true import json import os