DominoBench / scripts /agy_tool_audit.py
emilioferrara's picture
Harness update: Antigravity CLI backend (tools denied, web search forbidden, transcript audit), Claude run tags, timeout fix; card documents the Antigravity safeguards (part 2)
1bdbac8 verified
Raw History Blame Contribute Delete
3.19 kB
"""Audit Antigravity evaluation runs for tool use (2026-11-14 consistency check).
Each evaluation conversation leaves a transcript under eval/agy_home/.gemini/antigravity-cli/brain/<conversation_id>/
.system_generated/logs/transcript_full.jsonl, and each answer file records meta.conversation_id. For every answer file
of every antigravity-cli model, this finds its transcript (if kept), lists the tool calls the model made and whether
each one executed or was refused, and reports answers whose conversation executed any tool other than reading the
picture. Writes the list of affected answer files to results/agy_tool_audit.json."""
import collections
import glob
import json
import os
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
B = os.path.join(ROOT, "eval/agy_home/.gemini/antigravity-cli/brain")
ALLOWED = {"read_file", "view_file"}
def conversation_tools(cid):
"""[(tool, executed?, detail)] for one conversation, or None if its transcript was not kept."""
f = os.path.join(B, cid, ".system_generated", "logs", "transcript_full.jsonl")
if not os.path.exists(f):
return None
steps = []
for line in open(f):
try:
steps.append(json.loads(line))
except Exception:
pass
out = []
for i, s in enumerate(steps):
for call in s.get("tool_calls") or []:
name = call.get("name")
# the step(s) after a planner call carry its outcome; a refusal names the deny rule or permission
nxt = json.dumps(steps[i + 1:i + 3])
refused = any(w in nxt for w in ("deny rule", "Permission denied", "permission check failed",
"auto-denied", "not allowed"))
out.append((name, not refused, json.dumps(call.get("args"))[:160]))
return out
summary = collections.Counter()
affected, missing, total = [], 0, 0
for d in sorted(glob.glob(os.path.join(glob.escape(ROOT), "results", "m*", "antigravity-cli__*"))):
for f in sorted(glob.glob(os.path.join(glob.escape(d), "*.json"))):
j = json.load(open(f))
cid = (j.get("meta") or {}).get("conversation_id")
total += 1
tl = conversation_tools(cid) if cid else None
if tl is None:
missing += 1
continue
executed = sorted({t for t, ok, _ in tl if ok and t not in ALLOWED})
for t, ok, _ in tl:
summary[(t, "executed" if ok else "refused")] += 1
if executed:
affected.append({"file": os.path.relpath(f, ROOT), "tools": executed,
"correct_item": j.get("correct_item")})
print(f"answer files: {total}; transcript found for {total - missing}; missing {missing}")
print("tool calls (name, outcome): ", dict(sorted(summary.items())))
by_model = collections.Counter(a["file"].split("/")[2] for a in affected)
print(f"answers whose conversation EXECUTED a tool other than reading the picture: {len(affected)}", dict(by_model))
print("tools executed in those:", collections.Counter(t for a in affected for t in a["tools"]))
json.dump(affected, open(os.path.join(ROOT, "results", "agy_tool_audit.json"), "w"), indent=1)