Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

RDKit verdict summarises the molecule it judges, not the starter

deebad505075de4
diff --git a/store/agents/rdkit/toolchain/test_verdict.py b/store/agents/rdkit/toolchain/test_verdict.py
index 762ff9acd..905f52a7e 100644
--- a/store/agents/rdkit/toolchain/test_verdict.py
+++ b/store/agents/rdkit/toolchain/test_verdict.py
@@ -215,6 +215,24 @@ class Main(Workspace):
code, _, v = self.run_main(["verdict.py", str(named)])
self.assertEqual((code, v["artifact"]), (0, "out/named.sdf"))
+ def test_a_series_in_a_subfolder_is_summarised_by_its_own_report(self):
+ self.write("molecules/capsaicin.py", "")
+ self.write("out/report.json", json.dumps({**REPORT, "name": "ibuprofen"}), age=100)
+ self.write("out/ibuprofen.sdf", WATER_3D, age=100)
+ self.write("out/capsaicin/report.json", json.dumps({**REPORT, "name": "capsiate"}))
+ self.write("out/capsaicin/capsiate.sdf", WATER_3D)
+ code, _, v = self.run_main(["verdict.py"])
+ self.assertEqual((code, v["artifact"]), (0, "out/capsaicin/capsiate.sdf"))
+ self.assertTrue(v["summary"].startswith("capsiate · "), v["summary"])
+
+ def test_a_subfolder_without_its_own_report_falls_back_to_out(self):
+ self.write("molecules/water.py", "")
+ self.write("out/report.json", json.dumps({**REPORT, "name": "water"}))
+ self.write("out/extra/water.sdf", WATER_3D)
+ code, _, v = self.run_main(["verdict.py"])
+ self.assertEqual((code, v["artifact"]), (0, "out/extra/water.sdf"))
+ self.assertTrue(v["summary"].startswith("water · "), v["summary"])
+
def test_a_named_sdf_that_is_missing_is_judged_as_none(self):
self.write("molecules/water.py", "")
self.write("out/report.json", json.dumps(REPORT))
diff --git a/store/agents/rdkit/toolchain/verdict.py b/store/agents/rdkit/toolchain/verdict.py
index 9e614bdbf..1e25a2ea7 100644
--- a/store/agents/rdkit/toolchain/verdict.py
+++ b/store/agents/rdkit/toolchain/verdict.py
@@ -122,20 +122,37 @@ def inspect(path: Path) -> dict:
return info
+def read_report(ws: Path, artifact: Path | None) -> dict | None:
+ """The report of the molecule being judged. `write_outputs` puts a `report.json` in the folder it
+ writes to, so a series written to `out/<series>/` has its own beside its SDFs — reading only
+ `out/report.json` named whatever was written there last (the starter molecule, say) in the summary
+ of a series that is not it. The artifact's folder first, then each folder up to `out/`."""
+ out = ws / "out"
+ folders = []
+ if artifact is not None and artifact.parent.is_relative_to(out):
+ folder = artifact.parent
+ while folder != out and folder.is_relative_to(out):
+ folders.append(folder)
+ folder = folder.parent
+ folders.append(out)
+ for folder in folders:
+ candidate = folder / "report.json"
+ if candidate.exists():
+ try:
+ return json.loads(candidate.read_text())
+ except ValueError:
+ return None
+ return None
+
+
def main(argv: list[str]) -> int:
molecules = WS / "molecules"
has_design = any(molecules.glob("*.py")) or any(molecules.glob("*.smi"))
- report = None
- report_path = WS / "out" / "report.json"
- if report_path.exists():
- try:
- report = json.loads(report_path.read_text())
- except ValueError:
- report = None
path = Path(argv[1]).resolve() if len(argv) > 1 else newest_sdf(WS)
if path and not path.is_relative_to(WS): # the artifact is workspace-relative, and so is the pane
print(f"not judged · {argv[1]} is outside the workspace ({WS})", file=sys.stderr)
return 2
+ report = read_report(WS, path)
verdict = judge(has_design, report, inspect(path) if path and path.exists() else None)
(WS / ".harness").mkdir(exist_ok=True)
(WS / ".harness" / "verdict.json").write_text(json.dumps(verdict, indent=2) + "\n")