From 9ab050dd24ea22e1a34b840f93f3c0b9adb94c43 Mon Sep 17 00:00:00 2001 From: Etienne Filhol Date: Tue, 1 Dec 2026 20:40:27 +0100 Subject: [PATCH 1/7] feat(catalogue): label MedAgentBench's tasks for the Leaderboard --- .../catalogue/benchmarks/medagentbench/labels.json | 10 ++++++++++ .../catalogue/benchmarks/medagentbench/standard.json | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 app/nullius/catalogue/benchmarks/medagentbench/labels.json diff --git a/app/nullius/catalogue/benchmarks/medagentbench/labels.json b/app/nullius/catalogue/benchmarks/medagentbench/labels.json new file mode 100644 index 000000000..a003bf267 --- /dev/null +++ b/app/nullius/catalogue/benchmarks/medagentbench/labels.json @@ -0,0 +1,10 @@ +{ + "schema": 1, + "labels": [ + { + "axes": [ + "Health" + ] + } + ] +} diff --git a/app/nullius/catalogue/benchmarks/medagentbench/standard.json b/app/nullius/catalogue/benchmarks/medagentbench/standard.json index 0ec70690f..15ad5c6c1 100644 --- a/app/nullius/catalogue/benchmarks/medagentbench/standard.json +++ b/app/nullius/catalogue/benchmarks/medagentbench/standard.json @@ -65,7 +65,8 @@ }, "units": { "noun": "task", - "nouns": "tasks" + "nouns": "tasks", + "redistribute": false }, "controls": { "nop": { From 9e2cfef597081d695dd6a0e12a851d03136f3b8e Mon Sep 17 00:00:00 2001 From: Etienne Filhol Date: Tue, 1 Dec 2026 21:42:30 +0100 Subject: [PATCH 2/7] feat(standard): name tasks in labels whose ids the upstream publishes while their data stays unshared --- .agents/skills/label-benchmark/SKILL.md | 15 +++- .../label-benchmark/scripts/public_ids.py | 82 +++++++++++++++++++ app/nullius/leaderboard/labels.py | 5 +- app/nullius/standard/contract/definitions.py | 6 ++ app/tests/test_leaderboard_labels.py | 4 + app/tests/test_standard_controls.py | 11 +++ docs/standard.md | 1 + 7 files changed, 120 insertions(+), 4 deletions(-) create mode 100644 .agents/skills/label-benchmark/scripts/public_ids.py diff --git a/.agents/skills/label-benchmark/SKILL.md b/.agents/skills/label-benchmark/SKILL.md index f0f444756..6990eef48 100644 --- a/.agents/skills/label-benchmark/SKILL.md +++ b/.agents/skills/label-benchmark/SKILL.md @@ -63,6 +63,15 @@ benchmark's own statement in its README, paper or dataset description: the one d capability it says every task of the dataset is graded on. Never your reading of what a dataset is about. Such a rule labels the dataset in every release the second command lists it in: the statement must hold for each. Then hand over. +Unless the upstream repository itself publishes every task id (task files or folders, an id list, tracked at the +pinned commit, not a gated download): then propose `units.public_ids` too, the path where it does, in the same diff. +With it, both steps run and `labels.json` may name tasks, but a state holds only what that repository tracks at the +pinned commit (instructions, graders, tool names), never a record fetched behind a gate or a credential. Before the +proposal is shown, this must exit 0; it prints counts, never an id: +```bash +PYTHONPATH=REPO/app python3 SKILL/scripts/public_ids.py ENTRY +``` + ## The format `ENTRY/labels.json`: @@ -73,7 +82,8 @@ labels the dataset in every release the second command lists it in: the statemen ]} ``` -- Under `units.redistribute: false`, dataset rules instead, never both: `{"dataset": "retail", "axes": ["Shopping"]}`. +- Under `units.redistribute: false` with no `units.public_ids`, dataset rules instead, never both: + `{"dataset": "retail", "axes": ["Shopping"]}`. - A rule selects the whole benchmark (no `dataset`), one dataset, or the listed `tasks` of one dataset. A task's axes are the union of its rules' `axes`, minus their `not`. No other key, no prefix, no pattern. - `dataset` is a dataset of the definition, never a cut of another (`subset_of`): name the dataset it is cut from. @@ -211,7 +221,8 @@ PYTHONPATH=REPO/app python3 -c 'import json; from nullius.standard.contract impo Then report in a few lines, in `WORK/report.md` and to the user: -- the terms read, and `units.redistribute` as proposed; calls and cost, every run counted; +- the terms read, `units.redistribute` and `units.public_ids` as proposed, and `public_ids.py`'s counts; calls and + cost, every run counted; - per rule: the step or statement that gave it, and for step 2 the models and how many pairs agreed; - per axis: tasks labelled, disagreements left unlabelled, conflicts with a rule kept; the option values left out; labels proposed outside `labels.AXES`, written nowhere. diff --git a/.agents/skills/label-benchmark/scripts/public_ids.py b/.agents/skills/label-benchmark/scripts/public_ids.py new file mode 100644 index 000000000..c9bf1d6ce --- /dev/null +++ b/.agents/skills/label-benchmark/scripts/public_ids.py @@ -0,0 +1,82 @@ +"""Check that every task id ENTRY/labels.json names is one the upstream publishes, before it is written. + + PYTHONPATH=REPO/app python3 SKILL/scripts/public_ids.py ENTRY + +For a benchmark whose data may not be redistributed (``units.redistribute: false``), ``labels.json`` may name +tasks only under ``units.public_ids``: the path in the upstream repository where it publishes the ids. For each +version a ``tasks`` rule is ``checked`` at, this fetches the upstream at its pinned commit over HTTPS with no +credentials (a private repository fails here), and finds each id there, under that path, as a tracked file or +folder name or a whole word of a tracked file. Untracked files, a gated download among them, prove nothing. + +Prints counts, never an id. Exit 0: every id found; 1: not; 2: usage. +""" +import json +import os +import re +import subprocess +import sys +import tempfile + +from nullius.standard.contract import definitions + +WORD = re.compile(rb"[A-Za-z0-9_.\-]+") +QUIET = {**os.environ, "GIT_TERMINAL_PROMPT": "0", "GIT_ASKPASS": "true", "SSH_ASKPASS": "true", + "GIT_CONFIG_GLOBAL": os.devnull, "GIT_CONFIG_NOSYSTEM": "1"} + + +def git(*args, cwd): + return subprocess.run(["git", "-c", "credential.helper=", *args], cwd=cwd, env=QUIET, capture_output=True, + timeout=900, check=True).stdout + + +def published(repository, commit, path): + """Every name and word the repository tracks under ``path`` at ``commit``, fetched with no credentials.""" + if not repository.startswith("https://"): + sys.exit(f"{repository}: an https repository is needed, so that no credential is used") + with tempfile.TemporaryDirectory() as here: + git("init", "--quiet", cwd=here) + try: + git("fetch", "--quiet", "--depth", "1", repository, commit, cwd=here) + except subprocess.CalledProcessError: + sys.exit(f"{repository} at {commit}: not fetched without credentials, so not public") + files = git("ls-tree", "-r", "-z", "--name-only", "FETCH_HEAD", "--", path, cwd=here).split(b"\0") + files = [f for f in files if f] + if not files: + sys.exit(f"units.public_ids: {path} is not tracked at {commit}") + found = {part for f in files for part in f.split(b"/")} + for f in files: + found |= set(WORD.findall(git("show", f"FETCH_HEAD:{f.decode()}", cwd=here))) + return {w.decode(errors="replace") for w in found} + + +def main(): + if len(sys.argv) != 2: + sys.exit(2) + entry = os.path.abspath(sys.argv[1]) + key = os.path.basename(entry) + versions = {definitions.version_identity(b): b for b in definitions.load("benchmark", os.path.dirname(os.path.dirname(entry)), every=True)[0] + if b["key"] == key} + with open(os.path.join(entry, "labels.json"), encoding="utf-8") as f: + rules = [r for r in json.load(f)["labels"] if isinstance(r, dict) and "tasks" in r] + wanted = {} + for r in rules: + for v in r.get("checked") or []: + wanted.setdefault(v, set()).update(r["tasks"]) + missing, checked = 0, 0 + for v, ids in sorted(wanted.items()): + b = versions.get(v) + units = (b or {}).get("units") or {} + if units.get("redistribute") is not False: + continue # ids of such a version may be named anyway + if not units.get("public_ids"): + sys.exit(f"{v}: units.redistribute is false and no units.public_ids: no task id may be named") + there = published(b["upstream"]["repository"], b["upstream"]["tested"], units["public_ids"]) + lost = len(ids - there) + print(f"{v}: {len(ids)} ids, {len(ids) - lost} found under {units['public_ids']} at {b['upstream']['tested'][:12]}") + missing += lost + checked += len(ids) + print(f"{checked} ids checked, {missing} not published") + sys.exit(1 if missing else 0) + + +main() diff --git a/app/nullius/leaderboard/labels.py b/app/nullius/leaderboard/labels.py index 90f842122..ba36f36fa 100644 --- a/app/nullius/leaderboard/labels.py +++ b/app/nullius/leaderboard/labels.py @@ -93,7 +93,7 @@ def _rule(rule, shapes, task_ids): if "tasks" not in rule: return "checked: only with tasks" if "checked" in rule else Rule(frozenset(rule.get("axes", [])), frozenset(rule.get("not", [])), dataset) if not task_ids: - return "tasks: this benchmark's ids may not be redistributed (units.redistribute); dataset rules only" + return "tasks: this benchmark's ids may not be redistributed (units.redistribute, no units.public_ids); dataset rules only" if not _names(rule["tasks"]): return "tasks: a list of task ids, never empty" if not dataset: @@ -118,7 +118,8 @@ def check(document, versions) -> Labels: for b in versions: cuts = {d["id"]: d["subset_of"] for d in b.get("datasets") or [] if d.get("subset_of")} shapes[definitions.version_identity(b)] = ({d["id"] for d in b.get("datasets") or []} - set(cuts), cuts) - task_ids = all((b.get("units") or {}).get("redistribute") is not False for b in versions) + task_ids = all((b.get("units") or {}).get("redistribute") is not False or (b.get("units") or {}).get("public_ids") + for b in versions) rules, problems = [], [] for i, rule in enumerate(document["labels"]): got = _rule(rule, shapes, task_ids) diff --git a/app/nullius/standard/contract/definitions.py b/app/nullius/standard/contract/definitions.py index 434a3fa2a..2b14e32a2 100644 --- a/app/nullius/standard/contract/definitions.py +++ b/app/nullius/standard/contract/definitions.py @@ -1742,6 +1742,12 @@ def problems(d: dict, kind: str) -> List[str]: bad.append("units: {noun, nouns}") if "redistribute" in u and not isinstance(u["redistribute"], bool): bad.append("units.redistribute: false when the data may not be redistributed") + if "public_ids" in u: + p = u["public_ids"] + if not (isinstance(p, str) and p and not os.path.isabs(p) and ".." not in p.split("/")): + bad.append("units.public_ids: the path in the upstream repository where it publishes the task ids") + elif u.get("redistribute") is not False or not (d.get("upstream") or {}).get("repository"): + bad.append("units.public_ids: only with units.redistribute: false and an upstream repository") cats = u.get("categories", {}) if not isinstance(cats, dict) or not all( isinstance(c, dict) and set(c) <= {"label", "names"} and isinstance(c.get("label", ""), str) diff --git a/app/tests/test_leaderboard_labels.py b/app/tests/test_leaderboard_labels.py index 08e61658a..2932bbfbc 100644 --- a/app/tests/test_leaderboard_labels.py +++ b/app/tests/test_leaderboard_labels.py @@ -67,6 +67,10 @@ def test_ids_that_may_not_ship_get_dataset_rules_only(self): closed = [dict(b, units=dict(b["units"], redistribute=False)) for b in BENCH] got = labels.check({"schema": 1, "labels": RULES}, closed) self.assertEqual((got.rules, len(got.problems)), (GOOD.rules[:2], 2)) + public = [dict(b, units=dict(b["units"], public_ids="tasks")) for b in closed] + self.assertEqual(labels.check({"schema": 1, "labels": RULES}, public), GOOD) + one = [public[0], closed[1]] # a version without it still names none + self.assertEqual(len(labels.check({"schema": 1, "labels": RULES}, one).problems), 2) def test_a_file_that_does_not_read_labels_nothing(self): import tempfile diff --git a/app/tests/test_standard_controls.py b/app/tests/test_standard_controls.py index 15d12060d..f59b890cf 100644 --- a/app/tests/test_standard_controls.py +++ b/app/tests/test_standard_controls.py @@ -57,6 +57,17 @@ def test_units_that_may_not_be_redistributed_say_so_with_a_boolean(self): self.assertIn("units.redistribute: false when the data may not be redistributed", definitions.problems(dict(self.b, units=dict(units, redistribute="no")), "benchmark")) + def test_public_ids_name_a_path_of_a_repository_whose_data_may_not_be_redistributed(self): + b = dict(self.b, upstream={"repository": "https://example.org/up", "tested": "a" * 40, "license": "MIT"}) + named = lambda **u: definitions.problems(dict(b, units=dict(self.b["units"], **u)), "benchmark") + self.assertEqual(named(redistribute=False, public_ids="data/tasks.json"), []) + for path in ("", "/etc/tasks", "../tasks", True): + self.assertIn("units.public_ids: the path in the upstream repository where it publishes the task ids", + named(redistribute=False, public_ids=path)) + held = "units.public_ids: only with units.redistribute: false and an upstream repository" + self.assertIn(held, named(public_ids="tasks")) + self.assertIn(held, definitions.problems(dict(self.b, units=dict(self.b["units"], redistribute=False, public_ids="tasks")), "benchmark")) + def test_an_agent_cannot_take_a_controls_name(self): a = definitions.get("agent", "fake", FIX) self.assertIn("key: nop is the word for a benchmark's control", definitions.problems(dict(a, key="nop"), "agent")) diff --git a/docs/standard.md b/docs/standard.md index c69f2e7fc..8b8bd39d3 100644 --- a/docs/standard.md +++ b/docs/standard.md @@ -464,6 +464,7 @@ An `answer` or `score` error that begins `EnvironmentSetupError: `, `VerifierErr | `limits.retries` | The upstream's own retries of a failed unit (0 to 9): a run's `--retries` when none is given | | `limits.scored_cuts` | The cuts after which an agent's unit is still scored: `time`, `calls`, `end` ([a unit cut at a limit](cli/run.md#a-unit-cut-at-a-limit)) | | `units.redistribute` | `false` when the data may not be redistributed: `cli prove` then records no unit id | +| `units.public_ids` | With `redistribute: false`: the path in the upstream repository where it publishes the unit ids. `labels.json` may then name units; the data stays unshared | | `units.categories` | `{FIELD: {label, names: {VALUE: name}}}`: how `describe`'s categories read on a listing; `--category` still takes the value | !!! note "Call the upstream, never copy it" From 030b80c7486428464cecade60abb5cbeaefdc94d Mon Sep 17 00:00:00 2001 From: Etienne Filhol Date: Tue, 1 Dec 2026 21:43:39 +0100 Subject: [PATCH 3/7] feat(catalogue): name MedAgentBench's tasks in its labels --- .../benchmarks/medagentbench/labels.json | 412 ++++++++++++++++++ .../benchmarks/medagentbench/standard.json | 3 +- 2 files changed, 414 insertions(+), 1 deletion(-) diff --git a/app/nullius/catalogue/benchmarks/medagentbench/labels.json b/app/nullius/catalogue/benchmarks/medagentbench/labels.json index a003bf267..56f8a5a7c 100644 --- a/app/nullius/catalogue/benchmarks/medagentbench/labels.json +++ b/app/nullius/catalogue/benchmarks/medagentbench/labels.json @@ -5,6 +5,418 @@ "axes": [ "Health" ] + }, + { + "dataset": "v2", + "checked": [ + "99260117137b09f04837a8c18d18a1107efa55ae" + ], + "tasks": [ + "task1_29", + "task1_30" + ], + "axes": [ + "Abstention" + ] + }, + { + "dataset": "v2", + "checked": [ + "99260117137b09f04837a8c18d18a1107efa55ae" + ], + "tasks": [ + "task5_2", + "task5_3", + "task5_4", + "task5_9", + "task5_12", + "task5_14", + "task5_24", + "task5_26", + "task8_16", + "task8_19", + "task9_1", + "task9_2", + "task9_3", + "task9_4", + "task9_5", + "task9_6", + "task9_7", + "task9_8", + "task9_9", + "task9_10", + "task9_11", + "task9_12", + "task9_13", + "task9_14", + "task9_15", + "task9_16", + "task9_17", + "task9_18", + "task9_19", + "task9_20", + "task9_21", + "task9_22", + "task9_23", + "task9_24", + "task9_25", + "task9_26", + "task9_27", + "task9_28", + "task9_29", + "task9_30", + "task10_1", + "task10_2", + "task10_3", + "task10_4", + "task10_5", + "task10_6", + "task10_7", + "task10_8", + "task10_9", + "task10_10", + "task10_11", + "task10_12", + "task10_13", + "task10_14", + "task10_15", + "task10_16", + "task10_17", + "task10_18", + "task10_19", + "task10_20", + "task10_21", + "task10_22", + "task10_23", + "task10_24", + "task10_25", + "task10_26", + "task10_27", + "task10_28", + "task10_29", + "task10_30" + ], + "axes": [ + "Exactness" + ] + }, + { + "dataset": "v2", + "checked": [ + "99260117137b09f04837a8c18d18a1107efa55ae" + ], + "tasks": [ + "task1_1", + "task1_2", + "task1_3", + "task1_4", + "task1_5", + "task1_6", + "task1_7", + "task1_8", + "task1_9", + "task1_10", + "task1_11", + "task1_12", + "task1_13", + "task1_14", + "task1_15", + "task1_16", + "task1_17", + "task1_18", + "task1_19", + "task1_20", + "task1_21", + "task1_22", + "task1_23", + "task1_24", + "task1_25", + "task1_26", + "task1_27", + "task1_28", + "task2_1", + "task2_2", + "task2_3", + "task2_4", + "task2_5", + "task2_6", + "task2_7", + "task2_8", + "task2_9", + "task2_10", + "task2_11", + "task2_12", + "task2_13", + "task2_14", + "task2_15", + "task2_16", + "task2_17", + "task2_18", + "task2_19", + "task2_20", + "task2_21", + "task2_22", + "task2_23", + "task2_24", + "task2_25", + "task2_26", + "task2_27", + "task2_28", + "task2_29", + "task2_30", + "task4_1", + "task4_2", + "task4_3", + "task4_4", + "task4_5", + "task4_6", + "task4_7", + "task4_8", + "task4_9", + "task4_10", + "task4_11", + "task4_12", + "task4_13", + "task4_14", + "task4_15", + "task4_16", + "task4_17", + "task4_18", + "task4_19", + "task4_20", + "task4_21", + "task4_22", + "task4_23", + "task4_24", + "task4_25", + "task4_26", + "task4_27", + "task4_28", + "task4_29", + "task4_30", + "task5_1", + "task5_2", + "task5_3", + "task5_4", + "task5_5", + "task5_6", + "task5_7", + "task5_8", + "task5_9", + "task5_10", + "task5_12", + "task5_13", + "task5_14", + "task5_15", + "task5_16", + "task5_17", + "task5_18", + "task5_19", + "task5_20", + "task5_21", + "task5_22", + "task5_23", + "task5_25", + "task5_26", + "task5_27", + "task5_28", + "task5_29", + "task5_30", + "task6_1", + "task6_2", + "task6_3", + "task6_4", + "task6_5", + "task6_6", + "task6_7", + "task6_8", + "task6_9", + "task6_10", + "task6_11", + "task6_12", + "task6_13", + "task6_14", + "task6_15", + "task6_16", + "task6_17", + "task6_18", + "task6_19", + "task6_20", + "task6_21", + "task6_22", + "task6_23", + "task6_24", + "task6_25", + "task6_26", + "task6_27", + "task6_28", + "task6_29", + "task6_30", + "task7_1", + "task7_2", + "task7_3", + "task7_4", + "task7_5", + "task7_6", + "task7_7", + "task7_8", + "task7_9", + "task7_10", + "task7_11", + "task7_12", + "task7_13", + "task7_14", + "task7_15", + "task7_16", + "task7_17", + "task7_18", + "task7_19", + "task7_20", + "task7_21", + "task7_22", + "task7_23", + "task7_24", + "task7_25", + "task7_26", + "task7_27", + "task7_28", + "task7_29", + "task7_30", + "task10_11", + "task10_14" + ], + "axes": [ + "Retrieval" + ] + }, + { + "dataset": "v2", + "checked": [ + "99260117137b09f04837a8c18d18a1107efa55ae" + ], + "tasks": [ + "task3_22" + ], + "axes": [ + "Work" + ] + }, + { + "dataset": "v1", + "checked": [ + "99260117137b09f04837a8c18d18a1107efa55ae" + ], + "tasks": [ + "task1_9", + "task1_10" + ], + "axes": [ + "Abstention" + ] + }, + { + "dataset": "v1", + "checked": [ + "99260117137b09f04837a8c18d18a1107efa55ae" + ], + "tasks": [ + "task5_2", + "task5_3", + "task5_4", + "task5_9", + "task9_1", + "task9_2", + "task9_3", + "task9_4", + "task9_5", + "task9_6", + "task9_7", + "task9_8", + "task9_9", + "task9_10", + "task10_1", + "task10_2", + "task10_3", + "task10_4", + "task10_5", + "task10_6", + "task10_7", + "task10_8", + "task10_9", + "task10_10" + ], + "axes": [ + "Exactness" + ] + }, + { + "dataset": "v1", + "checked": [ + "99260117137b09f04837a8c18d18a1107efa55ae" + ], + "tasks": [ + "task1_1", + "task1_2", + "task1_3", + "task1_4", + "task1_5", + "task1_6", + "task1_7", + "task1_8", + "task2_1", + "task2_2", + "task2_3", + "task2_4", + "task2_5", + "task2_6", + "task2_7", + "task2_8", + "task2_9", + "task2_10", + "task4_1", + "task4_2", + "task4_3", + "task4_4", + "task4_5", + "task4_6", + "task4_7", + "task4_8", + "task4_9", + "task4_10", + "task5_1", + "task5_2", + "task5_3", + "task5_4", + "task5_5", + "task5_6", + "task5_7", + "task5_8", + "task5_9", + "task5_10", + "task6_1", + "task6_2", + "task6_3", + "task6_4", + "task6_5", + "task6_6", + "task6_7", + "task6_8", + "task6_9", + "task6_10", + "task7_1", + "task7_2", + "task7_3", + "task7_4", + "task7_5", + "task7_6", + "task7_7", + "task7_8", + "task7_9", + "task7_10" + ], + "axes": [ + "Retrieval" + ] } ] } diff --git a/app/nullius/catalogue/benchmarks/medagentbench/standard.json b/app/nullius/catalogue/benchmarks/medagentbench/standard.json index 15ad5c6c1..58671f8b5 100644 --- a/app/nullius/catalogue/benchmarks/medagentbench/standard.json +++ b/app/nullius/catalogue/benchmarks/medagentbench/standard.json @@ -66,7 +66,8 @@ "units": { "noun": "task", "nouns": "tasks", - "redistribute": false + "redistribute": false, + "public_ids": "data/medagentbench/test_data_v2.json" }, "controls": { "nop": { From d511d04fa1d952a4de7cddaebb6dd8e40639c209 Mon Sep 17 00:00:00 2001 From: Etienne Filhol Date: Tue, 1 Dec 2026 22:55:45 +0100 Subject: [PATCH 4/7] feat(catalogue): label MedAgentBench's v2 alone, v1 holding copies of its tasks --- .../benchmarks/medagentbench/labels.json | 118 +----------------- 1 file changed, 1 insertion(+), 117 deletions(-) diff --git a/app/nullius/catalogue/benchmarks/medagentbench/labels.json b/app/nullius/catalogue/benchmarks/medagentbench/labels.json index 56f8a5a7c..f4cd190f2 100644 --- a/app/nullius/catalogue/benchmarks/medagentbench/labels.json +++ b/app/nullius/catalogue/benchmarks/medagentbench/labels.json @@ -2,6 +2,7 @@ "schema": 1, "labels": [ { + "dataset": "v2", "axes": [ "Health" ] @@ -300,123 +301,6 @@ "axes": [ "Work" ] - }, - { - "dataset": "v1", - "checked": [ - "99260117137b09f04837a8c18d18a1107efa55ae" - ], - "tasks": [ - "task1_9", - "task1_10" - ], - "axes": [ - "Abstention" - ] - }, - { - "dataset": "v1", - "checked": [ - "99260117137b09f04837a8c18d18a1107efa55ae" - ], - "tasks": [ - "task5_2", - "task5_3", - "task5_4", - "task5_9", - "task9_1", - "task9_2", - "task9_3", - "task9_4", - "task9_5", - "task9_6", - "task9_7", - "task9_8", - "task9_9", - "task9_10", - "task10_1", - "task10_2", - "task10_3", - "task10_4", - "task10_5", - "task10_6", - "task10_7", - "task10_8", - "task10_9", - "task10_10" - ], - "axes": [ - "Exactness" - ] - }, - { - "dataset": "v1", - "checked": [ - "99260117137b09f04837a8c18d18a1107efa55ae" - ], - "tasks": [ - "task1_1", - "task1_2", - "task1_3", - "task1_4", - "task1_5", - "task1_6", - "task1_7", - "task1_8", - "task2_1", - "task2_2", - "task2_3", - "task2_4", - "task2_5", - "task2_6", - "task2_7", - "task2_8", - "task2_9", - "task2_10", - "task4_1", - "task4_2", - "task4_3", - "task4_4", - "task4_5", - "task4_6", - "task4_7", - "task4_8", - "task4_9", - "task4_10", - "task5_1", - "task5_2", - "task5_3", - "task5_4", - "task5_5", - "task5_6", - "task5_7", - "task5_8", - "task5_9", - "task5_10", - "task6_1", - "task6_2", - "task6_3", - "task6_4", - "task6_5", - "task6_6", - "task6_7", - "task6_8", - "task6_9", - "task6_10", - "task7_1", - "task7_2", - "task7_3", - "task7_4", - "task7_5", - "task7_6", - "task7_7", - "task7_8", - "task7_9", - "task7_10" - ], - "axes": [ - "Retrieval" - ] } ] } From 92b4662c86d3966b148fe7a2da0026742d2a90ce Mon Sep 17 00:00:00 2001 From: Etienne Filhol Date: Tue, 1 Dec 2026 23:12:27 +0100 Subject: [PATCH 5/7] Revert "feat(catalogue): label MedAgentBench's v2 alone, v1 holding copies of its tasks" This reverts commit d511d04fa1d952a4de7cddaebb6dd8e40639c209. --- .../benchmarks/medagentbench/labels.json | 118 +++++++++++++++++- 1 file changed, 117 insertions(+), 1 deletion(-) diff --git a/app/nullius/catalogue/benchmarks/medagentbench/labels.json b/app/nullius/catalogue/benchmarks/medagentbench/labels.json index f4cd190f2..56f8a5a7c 100644 --- a/app/nullius/catalogue/benchmarks/medagentbench/labels.json +++ b/app/nullius/catalogue/benchmarks/medagentbench/labels.json @@ -2,7 +2,6 @@ "schema": 1, "labels": [ { - "dataset": "v2", "axes": [ "Health" ] @@ -301,6 +300,123 @@ "axes": [ "Work" ] + }, + { + "dataset": "v1", + "checked": [ + "99260117137b09f04837a8c18d18a1107efa55ae" + ], + "tasks": [ + "task1_9", + "task1_10" + ], + "axes": [ + "Abstention" + ] + }, + { + "dataset": "v1", + "checked": [ + "99260117137b09f04837a8c18d18a1107efa55ae" + ], + "tasks": [ + "task5_2", + "task5_3", + "task5_4", + "task5_9", + "task9_1", + "task9_2", + "task9_3", + "task9_4", + "task9_5", + "task9_6", + "task9_7", + "task9_8", + "task9_9", + "task9_10", + "task10_1", + "task10_2", + "task10_3", + "task10_4", + "task10_5", + "task10_6", + "task10_7", + "task10_8", + "task10_9", + "task10_10" + ], + "axes": [ + "Exactness" + ] + }, + { + "dataset": "v1", + "checked": [ + "99260117137b09f04837a8c18d18a1107efa55ae" + ], + "tasks": [ + "task1_1", + "task1_2", + "task1_3", + "task1_4", + "task1_5", + "task1_6", + "task1_7", + "task1_8", + "task2_1", + "task2_2", + "task2_3", + "task2_4", + "task2_5", + "task2_6", + "task2_7", + "task2_8", + "task2_9", + "task2_10", + "task4_1", + "task4_2", + "task4_3", + "task4_4", + "task4_5", + "task4_6", + "task4_7", + "task4_8", + "task4_9", + "task4_10", + "task5_1", + "task5_2", + "task5_3", + "task5_4", + "task5_5", + "task5_6", + "task5_7", + "task5_8", + "task5_9", + "task5_10", + "task6_1", + "task6_2", + "task6_3", + "task6_4", + "task6_5", + "task6_6", + "task6_7", + "task6_8", + "task6_9", + "task6_10", + "task7_1", + "task7_2", + "task7_3", + "task7_4", + "task7_5", + "task7_6", + "task7_7", + "task7_8", + "task7_9", + "task7_10" + ], + "axes": [ + "Retrieval" + ] } ] } From 77ed5073edb85690d247f4767d39cfbc875c0219 Mon Sep 17 00:00:00 2001 From: Etienne Filhol Date: Tue, 1 Dec 2026 23:30:46 +0100 Subject: [PATCH 6/7] fix(standard): refuse a task id in labels unless listed and published, fetched with no credential --- .agents/skills/label-benchmark/SKILL.md | 30 ++-- .../label-benchmark/scripts/public_ids.py | 151 ++++++++++++------ app/nullius/standard/contract/definitions.py | 3 +- app/tests/test_leaderboard_labels.py | 25 +++ app/tests/test_standard_controls.py | 2 +- 5 files changed, 145 insertions(+), 66 deletions(-) diff --git a/.agents/skills/label-benchmark/SKILL.md b/.agents/skills/label-benchmark/SKILL.md index 61990a5a7..fbf4a73b1 100644 --- a/.agents/skills/label-benchmark/SKILL.md +++ b/.agents/skills/label-benchmark/SKILL.md @@ -58,20 +58,22 @@ Read the terms before the first `units` listing: it writes task text. A canary o reported and changes nothing below: task ids and labels are not the data. Gated data, data its authors ask not to reshare, or records about real people (patients, clients): propose -`units.redistribute: false` in the benchmark's definition, as a ```diff block for the user. With it, proposed or already set, no task id goes anywhere: -not into `labels.json`, the report or a model. Skip both steps. Write dataset rules alone (no `tasks`), each from the -benchmark's own statement in its README, paper or dataset description: the one domain it defines the dataset as, or a -capability it says every task of the dataset is graded on. Never your reading of what a dataset is about. Such a rule -labels the dataset in every release the second command lists it in: the statement must hold for each. Then hand over. - -Unless the upstream repository itself publishes every task id (task files or folders, an id list, tracked at the -pinned commit, not a gated download): then propose `units.public_ids` too, the path where it does, in the same diff. -With it, both steps run and `labels.json` may name tasks, but a state holds only what that repository tracks at the -pinned commit (instructions, graders, tool names), never a record fetched behind a gate or a credential. Before the -proposal is shown, this must exit 0; it prints counts, never an id: -```bash -PYTHONPATH=REPO/app python3 SKILL/scripts/public_ids.py ENTRY -``` +`units.redistribute: false` in the benchmark's definition, as a ```diff block for the user. Where the upstream +repository itself publishes every task id (task files or folders, an id list, tracked at the pinned commit, not a +gated download), propose `units.public_ids` in the same diff: the path where it does. + +- With `public_ids`: both steps run and `labels.json` may name tasks, but a state holds only what the upstream + publishes openly: what its repository tracks at the pinned commit, or a file its README links that downloads with + no login and that the definition pins by `sha256`. Never a record fetched behind a gate or a credential. Apply the + diff in the checkout, then, before the proposal is shown, this must exit 0; it prints counts, never an id: + ```bash + PYTHONPATH=REPO/app python3 SKILL/scripts/public_ids.py ENTRY + ``` +- Without it, proposed or already set: no task id goes anywhere, not into `labels.json`, the report or a model. Skip + both steps. Write dataset rules alone (no `tasks`), each from the benchmark's own statement in its README, paper or + dataset description: the one domain it defines the dataset as, or a capability it says every task of the dataset is + graded on. Never your reading of what a dataset is about. Such a rule labels the dataset in every release the + second command lists it in: the statement must hold for each. Then hand over. ## The format diff --git a/.agents/skills/label-benchmark/scripts/public_ids.py b/.agents/skills/label-benchmark/scripts/public_ids.py index c9bf1d6ce..43d78d3b9 100644 --- a/.agents/skills/label-benchmark/scripts/public_ids.py +++ b/.agents/skills/label-benchmark/scripts/public_ids.py @@ -1,82 +1,135 @@ -"""Check that every task id ENTRY/labels.json names is one the upstream publishes, before it is written. +"""Check every task id ENTRY/labels.json names, before the file is committed, for a benchmark whose data may not be +redistributed (``units.redistribute: false``). PYTHONPATH=REPO/app python3 SKILL/scripts/public_ids.py ENTRY -For a benchmark whose data may not be redistributed (``units.redistribute: false``), ``labels.json`` may name -tasks only under ``units.public_ids``: the path in the upstream repository where it publishes the ids. For each -version a ``tasks`` rule is ``checked`` at, this fetches the upstream at its pinned commit over HTTPS with no -credentials (a private repository fails here), and finds each id there, under that path, as a tracked file or -folder name or a whole word of a tracked file. Untracked files, a gated download among them, prove nothing. +Such a benchmark's labels may name tasks only under ``units.public_ids``, the path in the upstream repository where +it publishes the ids, and only ids that are, at each version a rule is ``checked`` at: +- listed by ``units`` for that dataset (the listing Nullius cached when the skill listed it); +- published: the upstream fetched at its pinned commit over HTTPS, with no credential, no user configuration and an + empty home (a private repository fails here), and the id found under that path as a tracked file or folder name + or a whole string value of a tracked ``.json`` or ``.jsonl`` file. Untracked files, a gated download among them, + prove nothing. +The file must also have no ``labels.check`` problem, and the definition on disk must be the one proposed. -Prints counts, never an id. Exit 0: every id found; 1: not; 2: usage. +Prints counts, never an id. Exit 0: every id passes, or the benchmark's ids may be named anyway; 1: refused. """ import json import os -import re import subprocess import sys import tempfile +from nullius.leaderboard import labels from nullius.standard.contract import definitions +from nullius.standard.runner import units -WORD = re.compile(rb"[A-Za-z0-9_.\-]+") -QUIET = {**os.environ, "GIT_TERMINAL_PROMPT": "0", "GIT_ASKPASS": "true", "SSH_ASKPASS": "true", - "GIT_CONFIG_GLOBAL": os.devnull, "GIT_CONFIG_NOSYSTEM": "1"} +def refusals(document, versions, listed, published) -> list: + """Why the ids of ``document`` may not be named; [] when they may. ``versions``: the benchmark at each version; + ``listed``: {(version, dataset): ids or None}; ``published``: {version: ids}. Counts, never an id.""" + if not versions: + return ["the benchmark: no version of it loads from ENTRY"] + problems = list(labels.check(document, versions).problems) + if problems: + return [f"labels.check: {len(problems)} problems; run the hand-over check"] + unit = versions[0].get("units") or {} + if unit.get("redistribute") is not False: + return [] + rules = [r for r in document["labels"] if "tasks" in r] + if rules and not unit.get("public_ids"): + return ["units.public_ids: not set, so no task id may be named"] + out = [] + for v in sorted({v for r in rules for v in r["checked"]}): + for ds in sorted({r["dataset"] for r in rules if v in r["checked"]}): + ids = {t for r in rules if v in r["checked"] and r["dataset"] == ds for t in r["tasks"]} + there = listed.get((v, ds)) + if there is None: + out.append(f"{v} {ds}: no cached listing; list its units first") + continue + if ids - set(there): + out.append(f"{v} {ds}: {len(ids - set(there))} of {len(ids)} ids not listed") + if ids - published.get(v, set()): + out.append(f"{v} {ds}: {len(ids - published.get(v, set()))} of {len(ids)} ids not published under {unit['public_ids']}") + return out -def git(*args, cwd): - return subprocess.run(["git", "-c", "credential.helper=", *args], cwd=cwd, env=QUIET, capture_output=True, - timeout=900, check=True).stdout +def _strings(value): + if isinstance(value, str): + yield value + elif isinstance(value, dict): + for k, x in value.items(): + yield k + yield from _strings(x) + elif isinstance(value, list): + for x in value: + yield from _strings(x) -def published(repository, commit, path): - """Every name and word the repository tracks under ``path`` at ``commit``, fetched with no credentials.""" + +def published(repository, commit, path) -> set: + """Every name and JSON string the repository tracks under ``path`` at ``commit``, fetched with no credential.""" if not repository.startswith("https://"): sys.exit(f"{repository}: an https repository is needed, so that no credential is used") - with tempfile.TemporaryDirectory() as here: - git("init", "--quiet", cwd=here) + with tempfile.TemporaryDirectory() as here, tempfile.TemporaryDirectory() as home: + env = {"PATH": os.environ.get("PATH", "/usr/bin:/bin"), "HOME": home, "XDG_CONFIG_HOME": home, + "GIT_CONFIG_NOSYSTEM": "1", "GIT_CONFIG_GLOBAL": os.devnull, "GIT_TERMINAL_PROMPT": "0", + "GIT_ASKPASS": "true", "SSH_ASKPASS": "true", "GIT_LFS_SKIP_SMUDGE": "1"} + git = lambda *a: subprocess.run(["git", "-c", "credential.helper=", *a], cwd=here, env=env, + capture_output=True, timeout=900, check=True).stdout + git("init", "--quiet") try: - git("fetch", "--quiet", "--depth", "1", repository, commit, cwd=here) + git("fetch", "--quiet", "--depth", "1", "--no-recurse-submodules", repository, commit) except subprocess.CalledProcessError: sys.exit(f"{repository} at {commit}: not fetched without credentials, so not public") - files = git("ls-tree", "-r", "-z", "--name-only", "FETCH_HEAD", "--", path, cwd=here).split(b"\0") - files = [f for f in files if f] + entries = [e.split(b"\t", 1) for e in git("ls-tree", "-r", "-z", "FETCH_HEAD", "--", path).split(b"\0") if e] + files = [name.decode() for meta, name in entries if meta.split()[1] == b"blob"] if not files: - sys.exit(f"units.public_ids: {path} is not tracked at {commit}") - found = {part for f in files for part in f.split(b"/")} + sys.exit(f"units.public_ids: {path} tracks no file at {commit}") + found = {part for f in files for part in f.split("/")} for f in files: - found |= set(WORD.findall(git("show", f"FETCH_HEAD:{f.decode()}", cwd=here))) - return {w.decode(errors="replace") for w in found} + if f.endswith((".json", ".jsonl")): + text = git("show", f"FETCH_HEAD:{f}").decode("utf-8", errors="replace") + try: + docs = [json.loads(text)] if f.endswith(".json") else [json.loads(x) for x in text.splitlines() if x.strip()] + except ValueError: + continue + for doc in docs: + found.update(_strings(doc)) + return found def main(): if len(sys.argv) != 2: - sys.exit(2) + sys.exit("usage: public_ids.py ENTRY") entry = os.path.abspath(sys.argv[1]) key = os.path.basename(entry) - versions = {definitions.version_identity(b): b for b in definitions.load("benchmark", os.path.dirname(os.path.dirname(entry)), every=True)[0] - if b["key"] == key} + versions = [b for b in definitions.load("benchmark", os.path.dirname(os.path.dirname(entry)), every=True)[0] if b["key"] == key] with open(os.path.join(entry, "labels.json"), encoding="utf-8") as f: - rules = [r for r in json.load(f)["labels"] if isinstance(r, dict) and "tasks" in r] - wanted = {} - for r in rules: - for v in r.get("checked") or []: - wanted.setdefault(v, set()).update(r["tasks"]) - missing, checked = 0, 0 - for v, ids in sorted(wanted.items()): - b = versions.get(v) - units = (b or {}).get("units") or {} - if units.get("redistribute") is not False: - continue # ids of such a version may be named anyway - if not units.get("public_ids"): - sys.exit(f"{v}: units.redistribute is false and no units.public_ids: no task id may be named") - there = published(b["upstream"]["repository"], b["upstream"]["tested"], units["public_ids"]) - lost = len(ids - there) - print(f"{v}: {len(ids)} ids, {len(ids) - lost} found under {units['public_ids']} at {b['upstream']['tested'][:12]}") - missing += lost - checked += len(ids) - print(f"{checked} ids checked, {missing} not published") - sys.exit(1 if missing else 0) + document = json.load(f) + by = {definitions.version_identity(b): b for b in versions} + rules = [r for r in document.get("labels") or [] if isinstance(r, dict) and "tasks" in r] + unit = (versions[0].get("units") or {}) if versions else {} + listed, seen = {}, {} + if versions and not labels.check(document, versions).problems and unit.get("redistribute") is False and unit.get("public_ids"): + for v in {v for r in rules for v in r["checked"]}: + b = by[v] + for ds in {r["dataset"] for r in rules if v in r["checked"]}: + d = next(x for x in b["datasets"] if x["id"] == ds) + try: + with open(units.cache_path(b, d, units.option_values(b, ds)), encoding="utf-8") as f: + listed[v, ds] = [t["id"] for t in json.load(f)["tasks"]] + except (OSError, ValueError, KeyError, TypeError, units.Refused): + listed[v, ds] = None + where = (b["upstream"]["repository"], b["upstream"]["tested"], unit["public_ids"]) + seen[v] = published(*where) + out = refusals(document, versions, listed, seen) + ids = sum(len(r["tasks"]) for r in rules if isinstance(r.get("tasks"), list)) + if not out and unit.get("redistribute") is not False: + print("units.redistribute is not false in ENTRY: its ids may be named; apply a proposed change first") + else: + print("\n".join(out) or f"{ids} named ids: every one listed and published") + sys.exit(1 if out else 0) -main() +if __name__ == "__main__": + main() diff --git a/app/nullius/standard/contract/definitions.py b/app/nullius/standard/contract/definitions.py index 6788dfee1..bdff8ea59 100644 --- a/app/nullius/standard/contract/definitions.py +++ b/app/nullius/standard/contract/definitions.py @@ -1743,8 +1743,7 @@ def problems(d: dict, kind: str) -> List[str]: if "redistribute" in u and not isinstance(u["redistribute"], bool): bad.append("units.redistribute: false when the data may not be redistributed") if "public_ids" in u: - p = u["public_ids"] - if not (isinstance(p, str) and p and not os.path.isabs(p) and ".." not in p.split("/")): + if not (isinstance(u["public_ids"], str) and _RELATIVE.match(u["public_ids"])): bad.append("units.public_ids: the path in the upstream repository where it publishes the task ids") elif u.get("redistribute") is not False or not (d.get("upstream") or {}).get("repository"): bad.append("units.public_ids: only with units.redistribute: false and an upstream repository") diff --git a/app/tests/test_leaderboard_labels.py b/app/tests/test_leaderboard_labels.py index a2420d237..26c97be50 100644 --- a/app/tests/test_leaderboard_labels.py +++ b/app/tests/test_leaderboard_labels.py @@ -72,6 +72,31 @@ def test_ids_that_may_not_ship_get_dataset_rules_only(self): one = [public[0], closed[1]] # a version without it still names none self.assertEqual(len(labels.check({"schema": 1, "labels": RULES}, one).problems), 2) + def test_the_label_skill_names_only_ids_listed_and_published(self): + """``public_ids.py``'s verdict, the fetch aside: every named id listed and published, or a refusal that + names none of them.""" + import importlib.util + path = os.path.join(os.path.dirname(__file__), "..", "..", ".agents", "skills", "label-benchmark", "scripts", "public_ids.py") + if not os.path.isfile(path): + self.skipTest("no label skill in this checkout") + spec = importlib.util.spec_from_file_location("public_ids", path) + script = importlib.util.module_from_spec(spec) + spec.loader.exec_module(script) + public = [dict(b, units=dict(b["units"], redistribute=False, public_ids="tasks")) for b in BENCH] + doc = {"schema": 1, "labels": RULES} + listed, seen = {("v1", "retail"): ["a", "b", "c"]}, {"v1": {"a", "b", "README.md"}} + self.assertEqual(script.refusals(doc, public, listed, seen), []) + self.assertEqual(script.refusals(doc, BENCH, {}, {}), []) # ids that may ship need nothing + refused = [script.refusals(doc, public, listed, {"v1": {"a"}}), # b unpublished + script.refusals(doc, public, {("v1", "retail"): ["a"]}, seen), # b unlisted + script.refusals(doc, public, {("v1", "retail"): None}, seen), + script.refusals(doc, [dict(b, units=dict(b["units"], redistribute=False)) for b in BENCH], listed, seen), + script.refusals({"schema": 1, "labels": [dict(RULES[2], tasks="ab")]}, public, listed, seen), + script.refusals(doc, [], listed, seen)] + for got in refused: + self.assertTrue(got) + self.assertFalse(any(f"'{t}'" in g or f" {t} " in g for g in got for t in "ab"), got) + def test_a_file_that_does_not_read_labels_nothing(self): import tempfile with tempfile.TemporaryDirectory() as here: diff --git a/app/tests/test_standard_controls.py b/app/tests/test_standard_controls.py index f59b890cf..9db96271a 100644 --- a/app/tests/test_standard_controls.py +++ b/app/tests/test_standard_controls.py @@ -61,7 +61,7 @@ def test_public_ids_name_a_path_of_a_repository_whose_data_may_not_be_redistribu b = dict(self.b, upstream={"repository": "https://example.org/up", "tested": "a" * 40, "license": "MIT"}) named = lambda **u: definitions.problems(dict(b, units=dict(self.b["units"], **u)), "benchmark") self.assertEqual(named(redistribute=False, public_ids="data/tasks.json"), []) - for path in ("", "/etc/tasks", "../tasks", True): + for path in ("", "/etc/tasks", "../tasks", ".", "./tasks", ":/", "a b", True): self.assertIn("units.public_ids: the path in the upstream repository where it publishes the task ids", named(redistribute=False, public_ids=path)) held = "units.public_ids: only with units.redistribute: false and an upstream repository" From e730839f4cd9e09fdd5c48d00080cca2d1417edf Mon Sep 17 00:00:00 2001 From: Etienne Filhol Date: Tue, 1 Dec 2026 23:31:30 +0100 Subject: [PATCH 7/7] fix(catalogue): find MedAgentBench's v1 ids in its own published file --- app/nullius/catalogue/benchmarks/medagentbench/standard.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/nullius/catalogue/benchmarks/medagentbench/standard.json b/app/nullius/catalogue/benchmarks/medagentbench/standard.json index 58671f8b5..6bf53d2ac 100644 --- a/app/nullius/catalogue/benchmarks/medagentbench/standard.json +++ b/app/nullius/catalogue/benchmarks/medagentbench/standard.json @@ -67,7 +67,7 @@ "noun": "task", "nouns": "tasks", "redistribute": false, - "public_ids": "data/medagentbench/test_data_v2.json" + "public_ids": "data/medagentbench" }, "controls": { "nop": {