Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/nullius/standard/runner/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ def driver(self) -> jsonl.Proc:
os.makedirs(cwd, exist_ok=True)
env = {"HOME": home, "NULLIUS_UPSTREAM": self.up or "", "NULLIUS_DATASET": self.data or "",
"NULLIUS_DATASET_ID": self.ds["id"], "NULLIUS_VERSION": str(self.bench.get("_version") or ""),
**option_env(self.bench_options), **self.question_env(), **data_env(), **self.file_env, **self.embeddings_env(), **self.driver_secrets()}
"NULLIUS_PROVIDER": getattr(self, "provider", "") or "", **option_env(self.bench_options), **self.question_env(), **data_env(), **self.file_env, **self.embeddings_env(), **self.driver_secrets()}
files = [h["path"] for s in definitions.secrets_of(self.bench)
if s.get("to") == "driver" and s.get("kind") == "file"
for h in [self.licences.get(s["name"])] if h] + list(self.file_env.values())
Expand All @@ -1254,7 +1254,7 @@ def driver(self) -> jsonl.Proc:
env = base_env(os.path.join(self.job_dir, ".work", "driver-home"),
{**extra, "NULLIUS_UPSTREAM": self.up or "", "NULLIUS_DATASET": self.data or "",
"NULLIUS_DATASET_ID": self.ds["id"], "PYTHONPATH": driver_path(), "PYTHONDONTWRITEBYTECODE": "1",
"NULLIUS_VERSION": str(self.bench.get("_version") or ""),
"NULLIUS_VERSION": str(self.bench.get("_version") or ""), "NULLIUS_PROVIDER": getattr(self, "provider", "") or "",
**({container.CHECK_IMAGE: self.image, **container.check_env()} if self.image else {}),
**option_env(getattr(self, "bench_options", {})), **self.question_env(), **data_env(), **self.file_env, **self.embeddings_env(), **self.driver_secrets(),
**limits.environment(getattr(self, "constraints", {}))})
Expand Down
22 changes: 22 additions & 0 deletions app/tests/test_standard_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,28 @@ def test_the_page_carries_each_datasets_controls_and_whether_proven(self):
self.assertEqual(c["fits"]["fakebench"], {"fake": [], "nop": [], "oracle": []})


class DriverKnowsTheProvider(unittest.TestCase):
"""The driver is told the run's provider, for an upstream that sends differently by provider."""
def test_the_driver_reads_the_runs_provider(self):
tmp = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmp, True)
here = os.path.join(tmp, "said")
os.makedirs(here)
with open(os.path.join(here, "driver.py"), "w") as f:
f.write('import os\nfrom nullius.standard.protocols.jsonl import serve\n'
'def score(unit, dir, transcript, answer, verified=None):\n'
' return {"reward": {"openai": 0.25, "openrouter": 0.75}.get(os.environ.get("NULLIUS_PROVIDER"), 0.0), "detail": {}}\n'
'serve({"units": lambda dataset: {"units": ["a"]}, "setup": lambda unit, dir: {"prompt": "hi"}, "score": score})\n')
b = dict(definitions.get("benchmark", "fakebench", FIX), _here=here, controls=CONTROLS,
driver={"command": ["python3", "{here}/driver.py"]})
for provider in ("openai", "openrouter"):
with self.subTest(provider):
job_dir = run.run(b, definitions.control(b, "nop"), model="", provider=provider,
jobs_root=os.path.join(tmp, provider), env={}, say=lambda s: None)
name = next(t for t in os.listdir(job_dir) if "__u" in t)
with open(os.path.join(job_dir, name, "result.json")) as f:
self.assertEqual(json.load(f)["verifier_result"]["rewards"]["reward"], {"openai": 0.25, "openrouter": 0.75}[provider])

class ProofDriverCredentials(unittest.TestCase):
def test_units_receive_saved_or_handed_driver_credentials_only(self):
from nullius import secrets
Expand Down
2 changes: 1 addition & 1 deletion docs/standard.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ its local proof records, saved runs and credentials remain. Proofs the bundled e
1. **Scaffold it.** `cli new benchmark KEY` (`--family module --port cap.memory/v1` for a Module benchmark) writes `benchmarks/<key>/standard.json` and `driver.py` under your user catalogue (`nullius paths`).
2. **Pin the data.** `upstream.repository` and `upstream.tested`, a full commit: the latest release tag's (`upstream.tag`; an annotated tag's commit is the `^{}` line of `git ls-remote --tags`), a default-branch commit only without a release. Each dataset: its `path` in the upstream or its `url` at a revision, its `sha256` and `units`; optional `subset_of`, the id of a list cut from none that holds every unit of this one. Installs and upstreams go under `STANDARD_DIR` (`~/.local/share/nullius/standard` on Linux by default), downloaded datasets under its `datasets/` or `STANDARD_DATA_DIR`.
3. **Choose the needs.** The fewest ports: `agent.workspace/v1` for files, `agent.search/v1` for search and source retrieval, `agent.tools/v1` for MCP tools, `agent.conversation/v1` if a user speaks more than once; a skill the units cannot be done without goes in `needs_skills`. `[]` with an `original` setup: no agent is offered.
4. **Write the driver.** It answers the [ops below](#driver-ops); the dataset file is `$NULLIUS_DATASET` (empty for a dataset with no `path` or `url`), the upstream `$NULLIUS_UPSTREAM`, the version `$NULLIUS_VERSION`. Keep the tests out of the workspace until `score`; prints go to stderr.
4. **Write the driver.** It answers the [ops below](#driver-ops); the dataset file is `$NULLIUS_DATASET` (empty for a dataset with no `path` or `url`), the upstream `$NULLIUS_UPSTREAM`, the version `$NULLIUS_VERSION`, the run's provider `$NULLIUS_PROVIDER` (`openrouter`, `openai`, `anthropic`, `custom`), for an upstream that sends differently by provider. Keep the tests out of the workspace until `score`; prints go to stderr.
5. **Its own options**, when the upstream offers a choice a run should make ([below](#benchmark-options)).
6. **Add the catalogue entry.** `benchmark.json` beside it, with `standard` in `harness`. A contribution to the bundled catalogue also adds its mark in `app/static/catalogue/marks.svg`.
7. **Declare its controls** ([Controls and proofs](#controls-and-proofs)).
Expand Down