#!/usr/bin/env python3 from __future__ import annotations import csv import pathlib from collections import Counter base = pathlib.Path("Biomanus/experiments/execution_audit") final = base / "domain_env_reaudit_10pct_cached_continuation_20260713_final_repaired/final_tool_execution_rows.csv" fail = [r for r in csv.DictReader(final.open()) if r["ok"].lower() != "true"] print("failed tools", len(fail), "servers", len({(r["category"], r["server"]) for r in fail})) print("by server") for (cat, server), n in Counter((r["category"], r["server"]) for r in fail).most_common(): print(cat, server, n) roots = [ base / "domain_env_reaudit_10pct_cached_continuation_20260713", base / "domain_env_reaudit_10pct_cached_continuation_20260713_repair16", ] details = {} for root in roots: for p in root.glob("*/*/*_tool_fixture_reaudit.csv"): for r in csv.DictReader(p.open()): details[(r.get("category"), r.get("server"), r.get("tool"))] = (p, r) print("\nexamples detail") for r in fail: key = (r["category"], r["server"], r["tool"]) p, d = details.get(key, (None, {})) print("---", key, "file", p) print("err", d.get("error_type"), "kwargs", (d.get("kwargs") or "")[:300]) print((d.get("stderr") or "")[:1200].replace("\n", " | "))