trykubi-admin's picture
Add per-trial timeline.json, Kubi server log and agent-view video; README says what stands in for the lost recordings
bf41703 verified
Raw History Blame Contribute Delete
61.8 kB
# Builds this dataset (README.md and excluded/EXCLUDED.md included) from Kubi's Cua Driver Bench v2 runs of
# 2026-11-23 (the folders k1123, k1123s, k1123s2 beside it), in the layout of Scale's
# earakely-scale/CuaDriverBench-AgentEnv. Read only on the sources.
# uv run --with pandas --with pyarrow python build.py
# Also reads serverlog/history_event.jsonl beside it: prod's history rows for the bench screens, copied off with
# pull-kubi-data's tools/sql on 2026-11-23 (prod keeps them 30 days). Needs ffmpeg and Pillow (--with pillow).
# Needs: the bench at ceeda722 checked out at $CUA_SRC (default /tmp/audit/cua), for the briefs, and Scale's
# trials.parquet and tasks.parquet (for the column set and the task titles) at $SCALE_DIR (default /tmp/pkg).
import base64, glob, hashlib, io, json, os, pathlib, re, shutil, subprocess, sys, tempfile
from datetime import datetime, timezone
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
HERE = pathlib.Path(__file__).resolve().parent
SRC = HERE.parent
CUA = pathlib.Path(os.environ.get('CUA_SRC', '/tmp/audit/cua'))
SCALE = pathlib.Path(os.environ.get('SCALE_DIR', '/tmp/pkg'))
SHORT = ['MB-09', 'MB-10', 'MB-11', 'IR-01', 'IR-02', 'IR-03', 'IR-04']
LONG = ['CDB-G02', 'CDB-G03', 'CDB-G04']
BENCH_COMMIT = 'ceeda722bf54590f730698c093f4052a28f47cfa'
CLAUDE_CODE = '2.1.316'
MCP = 'https://mcp.trykubi.com'
BUDGET = 'You have about 6 minutes and at most 45 turns.'
KUBI_HOST = '90e4598'
BACKEND_CUT = datetime(2026, 11, 23, 14, 20, tzinfo=timezone.utc).timestamp()
MISSING = ['recording.mp4', 'web.mp4', 'sentinel.jsonl', 'workspace/']
SUBSTITUTES = {
'recording.mp4': 'agent_view.mp4: the screenshots the agent was sent, each held until the next, at trial time; '
'not a screen recording, so nothing between two screenshots is seen',
'timeline.json': "built from trajectory.json's timestamps, with each call matched to Kubi's server log "
'(server_log.jsonl); armed_at, disarmed_at, user and samples are null (no sentinel log)',
'sentinel.jsonl': "lost; the sentinel's per-trial summary is in row.json (disturbance, background, gui_only, a22)",
'workspace/': "lost; grade.json has the checker's verdict on each part of the final state, and the last frame "
'of agent_view.mp4 shows the screen when the agent stopped',
}
SERVERLOG = []
for _l in open(SRC / 'serverlog/history_event.jsonl'):
_h = json.loads(_l)
_h['t'] = datetime.fromisoformat(_h['at']).timestamp()
SERVERLOG.append(_h)
# which server operations each MCP tool can make; list_screens, guide, status and viewer_link never reach the screen
OPS = {'act': {'runActions'}, 'wait': {'runActions', 'getScreenshot'}, 'screenshot': {'getScreenshot'},
'zoom': {'getScreenshot'}, 'read_tree': {'getAccessibilityTree'}, 'apps': {'listApps', 'runActions', 'startExec'},
'run_script': {'runScript'}, 'page': {'runPage'}, 'clipboard': {'runActions', 'getClipboard', 'setClipboard'}}
VIEW_CACHE = SRC / 'agent-view-cache'
VIEW_VERSION = 'v1'
# ---------------------------------------------------------------- secrets
SECRET_RES = [
re.compile(r'kubi_[A-Za-z0-9]{20,}'),
re.compile(r'sk-or-v1-[0-9a-f]{64}'),
re.compile(r'sk-ant-[A-Za-z0-9_-]+'),
re.compile(r'Bearer [A-Za-z0-9._~+/=-]{16,}'),
re.compile(r'openrouter\.ai/workspaces/[^/\s"]+/keys/[0-9a-f]{16,}'), # an OpenRouter key's page (its id)
]
REDACTIONS = {}
def redact(s: str) -> str:
for rx in SECRET_RES:
s, n = rx.subn('[redacted]', s)
if n:
REDACTIONS[rx.pattern] = REDACTIONS.get(rx.pattern, 0) + n
return s
# ---------------------------------------------------------------- briefs, as xfce_session.py wrote them on the screen
def briefs():
B = CUA / 'libs/cua-driver-bench/automated-eval/macos_bench'
sys.path[:0] = [str(B), str(B / 'launch')]
home = pathlib.Path.home
pathlib.Path.home = classmethod(lambda cls: pathlib.PosixPath('/home/user')) # the screen's desktop user
import hyprland_session as hs, xfce_session as xs, bench_v2 as v2, cdb_fairness
out = {}
for t in SHORT + LONG:
spec = hs.task_spec(t)
for i in range(5):
seed = cdb_fairness.trial_seed(t, i)
if spec.get('kind') == 'cdb':
b = v2.brief_for(xs.LinuxCdbTask(spec, pathlib.Path('/tmp/pkg/x'), seed=seed).brief().strip(), 'foreground')
else:
b = hs.render_brief(t, seed, 'foreground')
out[(t, i)] = (seed, b)
pathlib.Path.home = home
return out
BRIEFS = briefs()
SYSTEM_PROMPT = None
TITLES = pd.read_parquet(SCALE / 'tasks.parquet').drop_duplicates('probe').set_index('probe').title.to_dict()
SCALE_TRIALS = pd.read_parquet(SCALE / 'trials.parquet')
def prompt(task, i, budget):
# agent-kubi.sh passes -p "$(cat brief.md)": the shell drops the brief's trailing newlines; the Sonnet runs' wrapper
# (claude-scale.sh) then appends "\n\n<budget>\n".
b = BRIEFS[(task, i)][1].rstrip('\n')
return b + '\n\n' + BUDGET + '\n' if budget else b
# ---------------------------------------------------------------- the trials
HAIKU, SONNET = 'kubi-haiku-5-5-2026-11-23', 'kubi-sonnet-5-5-2026-11-23'
SETUPS = {
HAIKU: dict(model='anthropic/claude-haiku-5.5', model_scale='anthropic/claude-haiku-5-5', budget=False, wording='old',
runner_commit='1a44117'),
SONNET: dict(model='anthropic/claude-sonnet-5.5', model_scale='anthropic/claude-sonnet-5-5', budget=True, wording=None,
runner_commit='abff8bc'),
}
# Scale's CDB-G04 trials had the bench's browser variant of the system prompt (claude_arms.py system_prompt_for(browser=True));
# every Kubi trial was sent the generic one, which run.json records.
G04_SCALE_PROMPT_LINE = "Do not use the internet; the task's localhost site is allowed."
G04_NOTE = ("Scale's CDB-G04 trials used the bench's browser variant of the system prompt, with \"Do not use the network.\" "
"replaced by \"" + G04_SCALE_PROMPT_LINE + "\" (claude_arms.py system_prompt_for(browser=True)). This trial "
"was sent the generic system prompt, with \"Do not use the network.\", as system_prompt records.")
# Scale's Sonnet 5.5 price table, USD per million tokens (reproduces Scale's cost_usd from its trial.json tokens)
SONNET_SCALE = dict(inputTokens=2.0, outputTokens=10.0, cacheCreationInputTokens=2.5, cacheReadInputTokens=0.20)
def counted():
out = []
for i in range(5):
out.append((HAIKU, f'k1123/r{i}', 'old'))
for g in ('g02', 'g03', 'g04'):
out.append((HAIKU, f'k1123/long-{g}-r{i}', 'old'))
out.append((SONNET, f'k1123s/g02-r{i}', 'old'))
out.append((SONNET, f'k1123s2/g03-r{i}', 'calc, files'))
out.append((SONNET, f'k1123s2/g04-r{i}', 'calc, files'))
out.append((SONNET, f'k1123s2/short-r{i}', 'calc, files'))
return out
EXCLUDED = {
'k1123s/g04-r0': 'old launch wording; the agent opened a terminal from the apps list and the GUI-only guard stopped it',
'k1123s/g04-r1': 'old launch wording; the agent opened a terminal from the apps list and the GUI-only guard stopped it',
'k1123s/g04-r2': 'old launch wording; the agent opened a terminal from the apps list and the GUI-only guard stopped it',
'k1123s/g04-r3': 'old launch wording; the agent opened a terminal from the apps list and the GUI-only guard stopped it',
'k1123s2/g03-r0-credit402': 'OpenRouter refused the request with 402 (out of credits) mid-trial; re-run as k1123s2/g03-r0',
'k1123s2/g03-r0-credit402b': 'OpenRouter refused the first request with 402 (out of credits); re-run as k1123s2/g03-r0',
'k1123s2/g04-r3-credit402': 'OpenRouter refused the request with 402 (out of credits) mid-trial; re-run as k1123s2/g04-r3',
}
REPLACED = { # counted trial folder -> the attempts it replaced
'k1123s2/g03-r0': ['k1123s2/g03-r0-credit402', 'k1123s2/g03-r0-credit402b'],
'k1123s2/g04-r3': ['k1123s2/g04-r3-credit402', 'k1123s/g04-r3'],
'k1123s2/g04-r0': ['k1123s/g04-r0'], 'k1123s2/g04-r1': ['k1123s/g04-r1'], 'k1123s2/g04-r2': ['k1123s/g04-r2'],
}
def iso(t):
return datetime.fromtimestamp(t, timezone.utc).isoformat(timespec='milliseconds').replace('+00:00', 'Z')
def sha(p):
h = hashlib.sha256()
with open(p, 'rb') as f:
for b in iter(lambda: f.read(1 << 20), b''):
h.update(b)
return h.hexdigest()
def text_of(c):
if isinstance(c, str):
return c
return ' '.join(y.get('text', '') for y in c or [] if isinstance(y, dict) and y.get('type') == 'text')
def ts(e):
t = e.get('timestamp')
return datetime.fromisoformat(t.replace('Z', '+00:00')).timestamp() if t else None
def server_rows(screen, t0, t1):
return [h for h in SERVERLOG if h['screen_id'] == screen and t0 - 1 <= h['t'] <= t1 + 2]
def match_server(uses, results, rows):
"""For each tool call, the server's history row of the screen call it made (or None): same operation, inside the
call's time, nearest to its start. Calls the MCP server refused never reach the screen and have none."""
agent = [h for h in rows if h['kind'] == 'call' and h['credential_name'] != 'eval']
used, out = set(), []
for c, _, t0 in uses:
tool = c['name'].split('__')[-1]
t1 = results.get(c['id'], (None, None))[1] or (t0 or 0) + 60
cand = [h for h in agent if h['id'] not in used and h['operation'] in OPS.get(tool, set())
and t0 is not None and t0 - 2 <= h['t'] <= t1 + 1]
h = min(cand, key=lambda h: abs(h['t'] - t0)) if cand else None
if h:
used.add(h['id'])
out.append(h)
return out
def agent_view(frames, title, end_s, key):
"""An mp4 of the screenshots the agent was sent, each from when it arrived until the next, on the trial's clock,
with a caption bar. frames: [(t, base64 webp, caption)]. Cached by key, since encoding is the slow part."""
from PIL import Image, ImageDraw, ImageFont
VIEW_CACHE.mkdir(exist_ok=True)
cached = VIEW_CACHE / f'{key}.mp4'
if cached.exists():
return cached
W, H, BAR = 1280, 720, 40
font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 18)
with tempfile.TemporaryDirectory() as tmp:
tmp = pathlib.Path(tmp)
def card(img, caption, name):
c = Image.new('RGB', (W, H + BAR), (16, 16, 16))
if img is not None:
img = img.convert('RGB')
img.thumbnail((W, H))
c.paste(img, ((W - img.width) // 2, (H - img.height) // 2))
ImageDraw.Draw(c).text((12, H + 10), caption[:130], font=font, fill=(235, 235, 235))
c.save(tmp / name)
seq = [(0.0, None, title)] + [(t, Image.open(io.BytesIO(base64.b64decode(b))), cap) for t, b, cap in frames]
lines = []
for k, (t, img, cap) in enumerate(seq):
card(img, cap, f'{k:05d}.png')
nxt = seq[k + 1][0] if k + 1 < len(seq) else max(end_s, t + 2)
lines += [f"file '{k:05d}.png'", f'duration {max(nxt - t, 0.2):.3f}']
lines.append(f"file '{len(seq) - 1:05d}.png'")
(tmp / 'list.txt').write_text('\n'.join(lines) + '\n')
part = tmp / 'out.mp4'
subprocess.run(['ffmpeg', '-loglevel', 'error', '-y', '-f', 'concat', '-safe', '0', '-i', str(tmp / 'list.txt'),
'-vf', 'fps=5,format=yuv420p', '-c:v', 'libx264', '-preset', 'veryfast', '-crf', '30',
'-movflags', '+faststart', str(part)], check=True)
shutil.move(part, cached)
return cached
def convert(run, folder, wording, dest_root, trial_rows, call_rows, board_rows):
s = SETUPS[run]
d = glob.glob(str(SRC / folder / '*' / 'results.jsonl'))
assert len(d) == 1, folder
base = pathlib.Path(d[0]).parent
runjson = json.load(open(base / 'run.json'))
trials = [json.loads(l) for l in open(base / 'trials.jsonl')]
made = []
for rec in trials:
row = rec['row']
task, i = row['task'], int(row['run_index'])
assert row['label'] == 'kubi' and rec['model'] == s['model'], (folder, rec['model'])
tr = base / 'transcripts' / f"{s['model'].replace('/', '_')}-kubi-{task}-{i}.jsonl"
raw = redact(tr.read_text()) if tr.exists() else ''
L = [json.loads(x) for x in raw.splitlines() if x.strip()]
res = next((x for x in reversed(L) if x['type'] == 'result'), None)
tl = task.lower()
trial_id = f'{tl}-r{i + 1}-foreground'
long = task.startswith('CDB')
task_file = ('kubi-' if s['budget'] else 'kubi-nobudget-') + (f'{tl}-foreground' if long else f'{tl}-r{i + 1}-foreground')
seed = row['seed']
assert seed == BRIEFS[(task, i)][0], (folder, task, i)
# model calls, tool calls, errors, as Scale counts them
ids, uses, results = [], [], {}
for x in L:
if x['type'] == 'assistant':
mid = x['message']['id']
if mid not in ids:
ids.append(mid)
for c in x['message'].get('content', []):
if c.get('type') == 'tool_use':
uses.append((c, ids.index(mid), ts(x)))
if x['type'] == 'user':
for c in x['message'].get('content') or []:
if isinstance(c, dict) and c.get('type') == 'tool_result':
results[c['tool_use_id']] = (c, ts(x))
terrs = 0
for k, (c, u, t0) in enumerate(uses):
r, t1 = results.get(c['id'], (None, None))
txt = text_of(r['content']) if r else ''
err = bool(r and (r.get('is_error') or txt[:12] == '{"error":{"c'))
terrs += err
name = c['name']
m = re.match(r'mcp__([^_]+)__(.+)', name)
call_rows.append(dict(os='linux', run=run, trial_id=trial_id, i=k, turn=u,
t0=None if t0 is None else round(t0 - row['started'], 3),
t1=None if t1 is None else round(t1 - row['started'], 3),
tool=m.group(2) if m else name, server=m.group(1) if m else None,
input=json.dumps(c.get('input'), ensure_ascii=False), error=err, result=txt[:600],
image=bool(r and isinstance(r['content'], list) and any(y.get('type') == 'image' for y in r['content']))))
# the timeline in Scale's shape, each call with the server's record of it, and the agent's view
st = row['started']
srows = server_rows(runjson['screen'], st, row['finished'])
matched = match_server(uses, results, srows)
tl_calls, frames = [], []
for k, ((c, u, t0), h) in enumerate(zip(uses, matched)):
r, t1 = results.get(c['id'], (None, None))
txt = text_of(r['content']) if r else ''
m = re.match(r'mcp__([^_]+)__(.+)', c['name'])
tool = m.group(2) if m else c['name']
tl_calls.append(dict(
i=k, id=c['id'], turn=u, t0=None if t0 is None else round(t0 - st, 3),
t1=None if t1 is None else round(t1 - st, 3), tool=tool, server=m.group(1) if m else None,
input=c.get('input'), error=bool(r and (r.get('is_error') or txt[:12] == '{"error":{"c')), result=txt[:600],
image=bool(r and isinstance(r['content'], list) and any(y.get('type') == 'image' for y in r['content'])),
kubi_server=None if h is None else dict(
at=round(h['t'] - st, 3), duration_ms=h['duration_ms'], operation=h['operation'], result=h['result'],
summary=h['summary'], event_id=h['id'], request_id=h['request_id'], screenshot_id=h['screenshot_id'])))
if r and isinstance(r['content'], list) and t1 is not None:
for y in r['content']:
if y.get('type') == 'image':
what = h['summary'] if h else json.dumps(c.get('input'), ensure_ascii=False)[:80]
frames.append((t1 - st, y['source']['data'], f'{t1 - st:6.1f} s after call {k + 1} of {len(uses)}, {tool}: {what}'))
texts = [dict(t=round(ts(x) - st, 3), turn=ids.index(x['message']['id']), text=c['text'])
for x in L if x['type'] == 'assistant' and ts(x)
for c in x['message'].get('content', []) if c.get('type') == 'text' and c.get('text', '').strip()]
end_s = max((ts(x) for x in L if ts(x)), default=row['finished']) - st
timeline = {'duration': round(row['finished'] - st, 3), 'armed_at': None, 'disarmed_at': None,
'calls': tl_calls, 'texts': texts, 'compactions': [], 'user': None, 'samples': None,
'kubi': {'source': SUBSTITUTES['timeline.json'], 'clock': "seconds from the runner's trial start; "
"t0 and t1 are the transcript's timestamps, kubi_server.at is the server's",
'calls_reaching_screen': sum(h is not None for h in matched),
'calls_refused_before_screen': sum(h is None and c['name'].split('__')[-1] in OPS for (c, _, _), h in zip(uses, matched)),
'calls_local_to_mcp': sum(c['name'].split('__')[-1] not in OPS for c, _, _ in uses)}}
# the grade
ev = row.get('evaluation') or {}
checks = ev.get('checks') or {}
cbool = {k: (v.get('passed') if isinstance(v, dict) else bool(v)) for k, v in checks.items()}
cdet = {k: {kk: vv for kk, vv in v.items() if kk != 'passed'} for k, v in checks.items() if isinstance(v, dict)}
g = row['gui_only']
live = [v for v in g['violations'] if v.get('kind') != 'tool_input']
traj = [v for v in g['violations'] if v.get('kind') == 'tool_input']
task_g = {'id': 'task', 'result': bool(ev.get('passed')), 'score': ev.get('score'),
'description': f"trycua's evaluator for {row['mode'].split('/')[-1] if long else task}",
'checks': cbool, 'check_details': cdet or None}
if ev.get('diagnostics'):
task_g['diagnostics'] = ev['diagnostics']
gui_g = {'id': 'gui_only', 'result': not live, 'violations': live, 'transient': [],
'description': "no way out of the GUI the guard saw (trycua's X11 guard in launch/xfce_session.py)"}
gui_t = {'id': 'gui_only_trajectory', 'result': not traj, 'violations': [v['detail'] for v in traj],
'trajectory_checked': bool(L), 'refused_calls': None, 'mentions': g.get('mentions', []),
'description': "no way out of the GUI in the agent's tool calls (trycua's scan_events on the transcript)"}
passed = bool(row['passed'])
reward = 1.0 if passed else 0.0
# agent outcome
ex = row.get('agent_exit')
if res is None:
if live:
agent_error = f"claude CLI stopped by the GUI-only guard (exit {ex}): {live[0].get('detail')}"
elif row.get('timed_out'):
agent_error = 'claude CLI timed out after 360s'
else:
agent_error = f'claude CLI exited with code {ex} without a result'
elif res.get('is_error'):
msg = '; '.join(res.get('errors') or []) or str(res.get('result') or '')
agent_error = f'claude CLI exited with code {ex}: {msg}'
else:
agent_error = None
mu = (res or {}).get('modelUsage') or {}
tokens = {k: {kk: v.get(kk) for kk in ('inputTokens', 'outputTokens', 'cacheReadInputTokens',
'cacheCreationInputTokens', 'thinkingTokens')} for k, v in mu.items()} or None
cost = (res or {}).get('total_cost_usd')
backend = '934e510' if row['started'] >= BACKEND_CUT else '0eade0e'
driver_version = f'kubi-host {KUBI_HOST}, api {backend}'
computer = runjson['screen']
app = row['mode'].split('/')[-1] if long else 'benchlab'
settings = [f'mcp={MCP}', 'claude --tools "" --allowed-tools mcp__kubi --strict-mcp-config',
'--effort medium', 'MAX_THINKING_TOKENS=16000', '--max-turns 45',
'provider=openrouter (ANTHROPIC_BASE_URL=https://openrouter.ai/api)',
f'mcp_launch_wording={wording}']
assert 'Do not use the network.' in runjson['system_prompt'] and G04_SCALE_PROMPT_LINE not in runjson['system_prompt']
n_credit = sum('credit402' in r for r in REPLACED.get(folder, []))
trial = dict(
trial_id=trial_id, task=tl, task_file=task_file, probe=task, condition='foreground', run_index=i + 1,
seed=seed, prompt=prompt(task, i, s['budget']), system_prompt=runjson['system_prompt'], max_turns=45,
timeout_s=360, os='linux', driver='kubi', computer=computer, settings=settings, app=app, model=s['model'],
harness='claude-code', harness_version=runjson['claude_code'], framework_version=None,
bench_commit=runjson['bench'], trycua_commit=runjson['bench'], started_at=iso(row['started']),
ended_at=iso(row['finished']), status='completed', steps=None, agent_error=agent_error, cost_usd=cost,
cost_from_calls=False, cost_usd_reported=cost, tokens=tokens,
num_turns=(res or {}).get('num_turns'), duration_s=(res['duration_ms'] / 1000 if res and res.get('duration_ms') is not None else None),
model_calls=len(ids), tool_calls=len(uses), tool_errors=terrs, reward=reward, passed=passed,
grade={'sentinel': None, 'task': task_g, 'gui_only': gui_g}, gui_only_trajectory=gui_t,
kubi={'run_index_0based': i, 'source': f'{folder}/{base.name}', 'screen': runjson['screen'],
'effort': 'medium', 'agent_exit': ex, 'agent_wall_s': row.get('agent_wall_s'),
'timed_out': row.get('timed_out'), 'checker_passed': row.get('checker_passed'),
'prompt_budget_line': s['budget'], 'mcp_launch_wording': wording,
'model_scale': s['model_scale'],
'replaced_attempts': REPLACED.get(folder, []), 'agent_summary': rec.get('agent'),
'stop': (res or {}).get('subtype'), 'terminal_reason': (res or {}).get('terminal_reason'),
'api_error_status': (res or {}).get('api_error_status'),
'cost_usd_at_scale_sonnet_prices': (round(sum(v.get(k, 0) * p for v in mu.values() for k, p in SONNET_SCALE.items()) / 1e6, 6)
if mu and 'sonnet' in s['model'] else None)})
if task == 'CDB-G04':
trial['kubi']['system_prompt_note'] = G04_NOTE
out = dest_root / trial_id
assert not out.exists(), out
out.mkdir(parents=True)
dump = lambda name, obj: (out / name).write_text(redact(json.dumps(obj, indent=1, ensure_ascii=False)) + '\n')
dump('trial.json', trial)
cmd = (f'cdb.evaluate() of launch/xfce_session.py ({row["mode"]} evaluator/evaluate.py)' if long else
f'python3 probes/{task}/evaluate.py --seed {seed} --state state.json --events events.jsonl --result result.json')
dump('grade.json', {
'gui_only': {'score': 1.0 if gui_t['result'] else 0.0, 'results': [gui_t]},
'grade': {'score': reward, 'command': cmd, 'exit_code': None, 'timed_out': bool(row.get('timed_out')),
'stdout_artifact': None, 'stderr_artifact': None, 'stdout_head': None, 'stderr_head': None,
'extracted_files': {'/grade/result.json': {'task': task_g['description'].split()[-1],
'results': [task_g, gui_g]},
'/grade/reward.txt': int(reward)},
'results': [{'id': 'reward', 'score': reward, 'result': passed,
'message': f'reward={reward} (checker passed={bool(ev.get("passed"))}, gui_only violations={len(g["violations"])})'}]}})
(out / 'trajectory.json').write_text(json.dumps(L, ensure_ascii=False))
dump('attempts.json', {'harness_errors': {'rate': 0, 'server': 0, 'setup': 0, 'credit': n_credit},
'replaced': [{'attempt': r, 'reason': EXCLUDED[r]} for r in REPLACED.get(folder, [])]})
dump('row.json', row)
dump('timeline.json', timeline)
(out / 'server_log.jsonl').write_text(''.join(redact(json.dumps({k: v for k, v in h.items() if k != 't'}, ensure_ascii=False)) + '\n' for h in srows))
key = hashlib.sha256((VIEW_VERSION + run + trial_id + raw + json.dumps([f[2] for f in frames])).encode()).hexdigest()[:24]
view = agent_view(frames, f'{run} {trial_id} ({task}): before the first screenshot', end_s, key)
shutil.copy(view, out / 'agent_view.mp4')
files = [{'path': p.name, 'bytes': p.stat().st_size, 'sha256': sha(p)} for p in sorted(out.iterdir())]
dump('manifest.json', {'recording_id': None, 'scope': None, 'format': None, 'fps': None, 'cursor': None,
'source': None, 'started_at': trial['started_at'], 'ended_at': trial['ended_at'],
'ended_by': None, 'segments': [], 'missing': MISSING, 'substitutes': SUBSTITUTES,
'agent_view': {'path': 'agent_view.mp4', 'frames': len(frames), 'fps': 5,
'width': 1280, 'height': 760, 'clock': "trial time, from the runner's start",
'source': 'the images in trajectory.json, as the agent received them'},
'files': files})
# the flat rows
trial_rows.append(dict(
trial_id=trial_id, run=run, os='linux', driver='kubi', driver_version=driver_version, task=tl, probe=task,
title=TITLES.get(task), condition='foreground', model=s['model'], harness='claude-code',
harness_version=runjson['claude_code'], effort='medium', reward=reward, passed=passed, on_board=True,
run_index=i + 1, seed=float(seed) if not long else None, task_file=task_file,
task_passed=bool(ev.get('passed')), task_score=ev.get('score'), task_checks=json.dumps(cbool),
gui_only=not g['violation'], gui_only_violations=json.dumps(g['violations']),
# foreground trials don't score A22: null as in Scale's foreground rows (row.json keeps trycua's values)
user_undisturbed=None, **{f'a22_{k}': None for k in
('key_focus', 'window_raised', 'typing', 'pointer', 'clipboard', 'space', 'dialog', 'activation')},
sentinel_ok=None, agent_error=agent_error, cost_usd=cost, cost_usd_reported=cost, model_calls=len(ids),
num_turns=trial['num_turns'], tool_calls=len(uses), tool_errors=terrs, duration_s=trial['duration_s'],
agent_window_s=row.get('agent_wall_s'), harness_errors=n_credit, started_at=trial['started_at'], recording=None,
trajectory=f'{dest_root.relative_to(HERE)}/{trial_id}/trajectory.json',
timeline=f'{dest_root.relative_to(HERE)}/{trial_id}/timeline.json', sentinel_log=None,
workspace=None))
board_rows.append(dict(os='Linux', driver='Kubi', driver_version=driver_version,
model='Claude Haiku 5.5' if 'haiku' in s['model'] else 'Claude Sonnet 5.5', task=task,
title=TITLES.get(task), condition='foreground', run=i + 1, passed=passed,
task_done=bool(ev.get('passed')), gui_only=not g['violation'], user_undisturbed=None,
seconds=float(round(trial['duration_s'] if trial['duration_s'] is not None else row['agent_wall_s'])),
model_calls=len(ids), cost_usd=cost, replay=None))
made.append(trial_id)
return made, runjson
# ---------------------------------------------------------------- README.md and excluded/EXCLUDED.md (written by main)
README_MD = r"""---
license: other
license_name: cc0-1.0-and-fsl-1.1-mit
license_link: LICENSE.md
pretty_name: Cua Driver Bench v2 on Kubi
language:
- en
task_categories:
- reinforcement-learning
- image-text-to-text
size_categories:
- n<1K
tags:
- computer-use
- gui-agents
- cua
- benchmark
- desktop
- linux
- mcp
- claude-code
- anthropic
configs:
- config_name: board
default: true
data_files:
- split: eval
path: results/board.parquet
- config_name: trials
data_files:
- split: eval
path: results/trials.parquet
- config_name: calls
data_files:
- split: eval
path: results/calls.parquet
- config_name: tasks
data_files:
- split: eval
path: tasks/tasks.parquet
viewer: true
---
# Cua Driver Bench v2 on Kubi
trycua's Cua Driver Bench v2, its ten GUI-only tasks in the Linux **foreground** condition, run by Claude Code on a
Kubi screen (an always-on Linux desktop rented through an API) through Kubi's hosted MCP server, on 2026-11-23. 100
trials: Claude Haiku 5.5 and Claude Sonnet 5.5, each task 5 times.
This dataset is laid out like Scale's
[earakely-scale/CuaDriverBench-AgentEnv](https://huggingface.co/datasets/earakely-scale/CuaDriverBench-AgentEnv),
so its Linux foreground rows (cua-driver and agent-desktop, Haiku 5.5 and Sonnet 5.5) and these can be compared file
for file and column for column. Read [Differences from Scale's runs](#differences-from-scales-runs) before comparing.
### What we found
@@HEADLINE@@
**Tuned on these tasks.** Kubi was fixed after failing on these same tasks (the IR-02 banner click, the IR-03 and
IR-04 GTK dropdown pointer grab, the G03 app list missing linked apps, the hosted MCP's launch wording; see
[Tuning on these tasks](#differences-from-scales-runs)). Scale's cua-driver and agent-desktop rows had no such second
chance. Read the Kubi column as a tuned result, not a blind one.
Scale's counts are its `trials.parquet` rows with `on_board`, `os == linux`, `condition == foreground`. Scale also
has off-board cua-driver runs of both models (`on_board` false): `haiku-5-5-2026-11-02` passed @@OFF_H@@ and
`sonnet-5-5-2026-11-03` passed @@OFF_S@@. At 50 trials a model the 95% ranges overlap: none of these differences is
significant. Every setup passes 34 or 35 of the 35 short (BenchLab) trials; they separate on the three multi-app
tasks.
## Results
@@RESULTS@@
@@RUNS@@
- **Cost, billed.** Claude Code's `total_cost_usd` at OpenRouter's prices (Sonnet 5.5: input $2, output $10, cache
write $2.50, cache read $0.10 per million tokens); it matched OpenRouter's bill for these runs. It covers model
tokens only, not the desktop. `cost_usd` and `cost_usd_reported` are this same number.
- **Cost at Scale's prices.** Scale's `cost_usd` uses Scale's own table (Sonnet 5.5: input $2, output $10, cache write
$2.50, cache read $0.20 per million, which reproduces Scale's `cost_usd` from its `trial.json` tokens on the three Sonnet
cua-driver trials checked). The Sonnet row's second cost recomputes ours from our tokens at that table (each
Sonnet `trial.json` has it as `kubi.cost_usd_at_scale_sonnet_prices`); compare that one with Scale's Sonnet
`cost_usd`. No single table reproduces
Scale's Haiku `cost_usd`, so for Haiku the two sides' costs have different price bases and any ratio is approximate.
- @@NULLS@@
- **Time** is Claude Code's own `duration_ms` from its `result` event, the same definition as Scale's `duration_s`.
`agent_window_s` is trycua's runner's agent wall time, which is not Scale's `agent_window_s` measurement.
- The three GUI-only failures are all CDB-G04: the agent opened GNOME Terminal and the bench's guard stopped it.
- `assets/comparison.html` is the full comparison against Scale's rows (charts, per-task tables). Its Scale data
comes from Scale's dataset under its Apache 2.0 licence.
### Driver versions
| Run | driver_version |
|---|---|
| `kubi-haiku-5-5-2026-11-23` | kubi-host 90e4598, api 0eade0e |
| `kubi-sonnet-5-5-2026-11-23` | kubi-host 90e4598, api 0eade0e before 14:20 UTC, 934e510 after |
The screen daemon (kubi-host) was 90e4598 throughout. The API backend was redeployed at 14:20 UTC with kubi-platform
934e510; each trial's `driver_version` names the one it ran against by its start time.
### Run notes
- **Trials counted with an agent error.** 12 Haiku trials and 5 Sonnet trials end with an `agent_error`:
- 10 Haiku (all CDB-G02 and CDB-G03) and 2 Sonnet hit the 45-turn limit (`Reached maximum number of turns (45)`).
- 3 were stopped by the GUI-only guard after opening a terminal (Haiku `cdb-g04-r2`, `cdb-g04-r4`; Sonnet
`cdb-g04-r4`). Claude Code was killed (exit 143), so these transcripts have no `result` event: `cost_usd`,
`num_turns`, `duration_s` and `tokens` are null for them.
- 2 Sonnet trials (`cdb-g02-r2`, `cdb-g04-r3`) got an OpenRouter 402 (credits) after the work was done; the
checker passed both, and they count as passes as the grade says.
- **Re-runs.** Sonnet `cdb-g03-r1` replaces two attempts that OpenRouter refused with 402, and Sonnet `cdb-g04-r1`
to `r4` replace an earlier set (one refused with 402, four with the old launch wording). Sonnet `cdb-g04-r5` ran
once. Each trial's `attempts.json` lists what it replaced; the attempts themselves are in `excluded/`
([excluded/EXCLUDED.md](excluded/EXCLUDED.md)).
- **Harness errors.** `harness_errors` counts the credit refusals that were run again, as recorded in each trial's
`attempts.json` (`harness_errors.credit`): 2 for Sonnet `cdb-g03-r1`, 1 for Sonnet `cdb-g04-r4`, 0 elsewhere. The
old-wording attempts are not harness errors (the agent opened a terminal) and are not counted there. Every counted
trial ran its checker and wrote its row.
## Differences from Scale's runs
These runs use trycua's own Linux runner, not Scale's AgentEnv port, and differ from Scale's runs in these ways:
- **Agent's tools.** Kubi's hosted MCP server (`https://mcp.trykubi.com`) is the agent's only tool server:
`--strict-mcp-config --tools "" --allowed-tools mcp__kubi`, so no built-in tools at all. Scale allows `Skill`
and `Read` beside the driver's MCP (cua-driver lists 74 tools). The agent's Kubi key had only `read` and
`control` on its one screen, so the MCP listed no exec or file tools. It listed 13 tools (the `tools` of every
trajectory's `system/init` event, and each run's `manifest.json`): @@TOOLS@@. Some do more per call than a
click-and-type driver:
- `run_script` runs JavaScript that calls `screenshot()`, `find()`, `act()` and `expect()`, so one tool call can
batch several actions (loops, read-then-act).
- `page` reads and fills a browser tab by reference, over Chromium's debugging port.
- `read_tree` reads the screen's accessibility tree; `act` clicks, types and acts on its elements by id.
- `apps` lists the screen's apps, and `act`'s `launch` starts one by id or name.
- **Context window and output limit.** Claude Code 2.1.316 reported a 1,000,000-token context window and 128,000 max
output tokens for both models in every Kubi trial with a `result` event (`modelUsage.contextWindow`,
`maxOutputTokens`). Scale's Claude Code 2.1.280 transcripts report 200,000 and 32,000.
- **Host and session.** A Kubi screen at 1920x1080 running trycua's Linux XFCE session and guard
(`launch/xfce_session.py` at the bench commit below), with trycua's X11 sentinel. Scale ran Ubuntu 24.04 on Xvfb
with xfwm4 under AgentEnv, its own sentinel and guard port, and graded in a separate container.
- **Bench commit.** trycua/cua `ceeda722` (whose tasks, checkers and seeds match Scale's), against Scale's task pack
`22a67eac` and bench port `eb36dcbe`. Each trial's `seed` and brief are the same as Scale's for that run index.
- **Prompt.**
- BenchLab briefs say "on this Linux computer" (trycua's Linux session's text); Scale's say "on your Mac".
- **Haiku: no budget line.** The Haiku run's prompts lack the closing "You have about 6 minutes and at most 45
turns." that Scale's runner adds. The Sonnet run's prompts have it, as Scale's do. The `task_file` says which:
`kubi-nobudget-*` (Haiku) and `kubi-*` (Sonnet), both in `tasks/tasks.parquet`.
- **System prompt.** Every Kubi trial was sent the bench's generic system prompt (`SYSTEM_PROMPT` in
`claude_arms.py`), passed with `--append-system-prompt`, so it is appended to Claude Code's own default system
prompt. Scale's trials of nine tasks have that same text. **CDB-G04 differs:** Scale's CDB-G04 trials used the
bench's browser variant (`system_prompt_for(browser=True)`), with "Do not use the network." replaced by "Do not
use the internet; the task's localhost site is allowed." Ours kept "Do not use the network." This applies to all
10 counted Kubi CDB-G04 trials (5 Haiku, 5 Sonnet) and the 5 excluded Sonnet CDB-G04 attempts. Their
`trial.json` `system_prompt` is the generic prompt we sent, and `kubi.system_prompt_note` says so.
- Our transcripts don't record the `-p` prompt. Each `prompt` here is rebuilt with the bench's own code
(`render_brief` and the task pack's brief at `ceeda722`, with each trial's seed) plus the wrapper's line. It is
what the runner sends, not a capture.
- **Hosted MCP launch wording.** The Kubi MCP's `act` tool gave its launch example literally as "(calc, terminal)".
kubi-platform 934e510 changed it to "(calc, files)" (committed 14:13:52 UTC, deployed 14:20 UTC; the first trial on
it started at 14:20:59 UTC). The Haiku run and Sonnet CDB-G02 ran with the old wording. Sonnet CDB-G03, CDB-G04 and
the short tasks ran on the new one. With the old wording Sonnet opened a terminal on CDB-G04 in four of four tries
(excluded). Each trial's `settings` and `kubi.mcp_launch_wording` say which wording it had.
- **Tuning on these tasks.** Kubi was changed after failing on these same tasks, in calibration runs on 2026-11-22
and on the day:
- IR-02: a click on Apply hit the update banner's button drawn over it; a click by element now goes through the
element's accessibility action (kubi-host f37c639).
- IR-03 and IR-04: choosing in a GTK dropdown left the app's pointer grab on its hidden menu, so the next click was
lost; the dropdown's own selection now chooses (kubi-host 90e4598).
- CDB-G03: the app list missed apps whose desktop entry is a link (GnuCash, LibreOffice), and the agent opened a
terminal instead (kubi-host d46e2bb).
- A key with only `read` and `control` still saw the exec and file tools, and Haiku opened a terminal; the MCP now
lists only what the key allows (kubi-platform 1395cf8).
- The launch wording above (kubi-platform 934e510).
Scale's cua-driver and agent-desktop rows had no such tuning. Treat these numbers as a tuned result, not a blind
one.
- **Effort and thinking.** `--effort medium` and `MAX_THINKING_TOKENS=16000`. Scale passes no `--effort` (medium is
Claude Code's default for the 5.5 models; its `effort` column is null for these runs).
- **Provider and model ids.** Claude Code reached the models through OpenRouter's Anthropic endpoint, so our `model`
is OpenRouter's id (`anthropic/claude-haiku-5.5`, `anthropic/claude-sonnet-5.5`). Scale's are
`anthropic/claude-haiku-5-5` and `anthropic/claude-sonnet-5-5`; to group across the two datasets, map ours with
`model.str.replace('.', '-')` (each `trial.json` also has `kubi.model_scale`). `trials.parquet` keeps Scale's 50
columns, so it has no extra model column. Scale's message ids (`msg_vrtx_...`) indicate Vertex.
- **Cost basis.** Ours is Claude Code's `total_cost_usd` at OpenRouter's prices; Scale's `cost_usd` is recomputed
from tokens at Scale's price table, and its `cost_usd_reported` is Claude Code's figure. See
[Results](#results) for the Sonnet costs on one table.
- **Claude Code version.** 2.1.316 (the version the bench pins), against Scale's 2.1.280.
- **Dates.** 2026-11-23, against Scale's 2026-11-06 (cua-driver) and 2026-11-06 to 11-11 (agent-desktop).
- **Excluded attempts.** Seven attempts are left out of the counts and kept in `excluded/`, each with its reason:
four Sonnet CDB-G04 tries with the old launch wording (terminal opened) and three Sonnet tries that OpenRouter
refused with 402 (out of credits). After the wording changed, those four CDB-G04 trials were run again and the
fifth, `cdb-g04-r5`, ran once, so all five counted Sonnet CDB-G04 trials had the new wording.
- **No screen recordings, sentinel logs or workspaces; a timeline, a server log and an agent view instead.** The
screens that ran these trials were deleted before their recording, `sentinel.jsonl` and final workspace were
copied off. Each trial's `manifest.json` lists them under `missing`, says what stands in for each under
`substitutes`, and their columns in `trials.parquet` are null. What each trial has instead:
- `timeline.json`, in Scale's shape: every tool call with its times, input and result (600 chars), from the
transcript's timestamps. Each call also has `kubi_server`: Kubi's own record of the screen call it made
(time, duration, operation, result, request id, screenshot id). `armed_at`, `disarmed_at`, `user` and
`samples` are null, since they come from the sentinel log.
- `server_log.jsonl`: Kubi's server log for the trial's screen during the trial, as prod's database recorded it
(copied off on 2026-11-23; prod keeps it 30 days). It is written by the screen's host, not by the bench runner
or the agent, so it is a second record of the same calls. Of the 1,581 tool calls in the 100 trials, 1,515
reached the screen and each has its server row; the other 66 are 60 calls the MCP server refused before they
reached the screen (all with an error in the transcript) and 6 that never touch a screen (`list_screens`,
`guide`). Rows by the runner's own key (`eval`) are the runner starting the agent and downloading its files.
- `agent_view.mp4`: the 1,158 screenshots the agents received, each held from when it arrived until the next, on
the trial's clock, with a caption naming the call that returned it. It is not a screen recording: nothing
between two screenshots is seen, and the screen is shown at the 1280x720 the agent saw.
- The sentinel's per-trial summary is in `row.json` (`disturbance`, `background`, `gui_only`, `a22`); the raw
event stream is gone.
- For the final state, `grade.json` has the checker's verdict on each part of it, and the last frame of
`agent_view.mp4` shows the screen when the agent stopped. The files themselves are gone.
- **Field meanings that differ.**
- `computer` is the Kubi screen's id.
- `started_at` and `ended_at` are the bench runner's trial start and end, not a recording's.
- `calls.parquet` and `timeline.json` times (`t0`, `t1`) are seconds from the trial's start, from the
transcript's timestamps, not from a recording. `trials.parquet`'s `timeline` column points to `timeline.json`.
- `a22_*` and `user_undisturbed` are null in `trials.parquet`, as in Scale's foreground rows: foreground trials
don't score them. trycua's runner computed them on our sentinel anyway; `row.json` keeps those values.
- `sentinel_ok` is null: trycua's runner has no "sentinel log covers the whole trial" check.
- `harness_errors` is the number of credit refusals run again (above); Scale's counts rate, server and setup
errors.
- Our grade's `gui_only` is the live guard's verdict; `gui_only_trajectory` is trycua's `scan_events` on the
transcript (Scale's own trajectory check is a port of it).
- CDB tasks have a seed in `trial.json` (the runner draws one) but it changes nothing in those tasks, so
`trials.parquet` leaves it null, as Scale does.
## The tasks
The same ten tasks as Scale's dataset (its "The tasks" section describes them), in the foreground condition only.
`tasks/tasks.parquet` has one row per trial task and prompt setup (76 rows): 35 BenchLab task files and 3 CDB task
files, once without the budget line (Haiku) and once with it (Sonnet).
## How a trial runs
kubi-platform's `api/scripts/cdb-bench.ts --run` calls trycua's runner on the screen for each trial:
`python3 launch/xfce_session.py --task <TASK> --run-index <i> --condition foreground --timeout 360 -- agent-kubi.sh`.
1. The runner resets the task, starts its apps and places their windows at 1920x1080, with trycua's X11 sentinel and
guard.
2. It starts the agent: `claude -p "$(cat brief.md)" --model <model> --effort medium --mcp-config mcp.json
--strict-mcp-config --tools "" --allowed-tools mcp__kubi --permission-mode bypassPermissions --setting-sources
project --max-turns 45 --output-format stream-json --verbose`, through a wrapper that adds the bench's generic
system prompt (and, for Sonnet, the budget line).
3. The guard watches for a way out of the GUI (a terminal, a run dialog, a program on a pseudo-terminal, macro
editor, DevTools) and stops the agent if it sees one. The runner stops it at 360 s.
4. The task's checker runs on the apps' state (BenchLab's `probes/<TASK>/evaluate.py`, or the task pack's evaluator
for the CDB tasks), and trycua's `scan_events` reads the transcript for forbidden tool use.
A trial passes only if the checker passes and there is no GUI-only violation.
## Dataset structure
```
results/board.parquet one row per trial, as Scale's board: OS, driver, model, task, run, the grade's halves, seconds, model calls, cost
results/trials.parquet one row per counted trial, Scale's 50 columns with Scale's Arrow types (concatenates with Scale's table); also results/trials.csv
results/calls.parquet one row per tool call, keyed by os, run and trial_id: times from the trial's start, its input, its result (600 chars)
results/missing.parquet empty: no counted trial is missing
tasks/tasks.parquet one row per trial task and prompt setup: the prompt, system prompt, built-in tools, limits, the runner's command
runs/linux/<run>/
manifest.json the run's bench commit, model, harness, effort, built-in tools, screens and the MCP's tool list
runs/linux/<run>/<trial>/
trial.json the trial's facts, Scale's keys, plus `kubi`: our 0-based run index, source folder, screen, exit code, wording, Scale's model id
grade.json the checker's result and both GUI-only verdicts, in Scale's grade.json shape
trajectory.json Claude Code's stream-json as a JSON list (screenshots included)
attempts.json harness errors and the excluded attempts this trial replaced
row.json trycua's runner's own row for the trial (not in Scale's layout)
timeline.json Scale's timeline shape from the transcript, each call with Kubi's server record of it
server_log.jsonl Kubi's server log for the trial's screen during the trial (not in Scale's layout)
agent_view.mp4 the screenshots the agent received, at trial time, with captions (not a recording)
manifest.json Scale's recording-manifest keys (null), plus `files` (sha256), `missing` and `substitutes`
excluded/<attempt>/<trial>/ the seven attempts not counted, same files, with REASON.txt; see excluded/EXCLUDED.md
assets/comparison.html the comparison with Scale's Linux foreground rows
build.py rebuilds this folder (this README included) from the run folders beside it
validate.py checks the folder: 100 trials, Scale's keys, columns and Arrow types, the pass counts
```
Run names follow Scale's: `kubi-<model>-<date>`, trial folders `<task>-r<run>-foreground` with Scale's 1-based run
index (`trial.json`'s `kubi.run_index_0based` is ours).
## Limitations
- Few trials per cell: 5 per task and model, as in Scale's runs.
- No screen recordings, sentinel logs or workspaces (above): a trial can be followed screenshot by screenshot and
checked call by call against Kubi's server log, but not watched continuously, and its final files can't be opened.
- The prompts are rebuilt, not captured (above).
- Tuned on these tasks, and the Haiku and Sonnet runs had different setups (budget line, launch wording): compare
each model with Scale's runs of it, and the two Kubi runs with care.
## Licence and attribution
The tasks, their apps, prompts, evaluators and scoring are trycua's Cua Driver Bench, © 2026 Cua AI, Inc., under the
[Functional Source License 1.1, MIT Future License](licenses/FSL-1.1-MIT.md). Everything Kubi made (trajectories,
grades, tables, the comparison page's code) is dedicated to the public domain under [CC0 1.0](licenses/CC0-1.0.txt);
Scale's figures in the comparison page are Scale's, under the [Apache License 2.0](licenses/Apache-2.0.txt). See
[LICENSE.md](LICENSE.md). The
layout follows Scale's dataset; this dataset is not Scale's or trycua's, and its results are not theirs.
"""
EXCLUDED_MD = r"""# Excluded attempts
Seven Claude Sonnet 5.5 attempts from 2026-11-23 that are not counted in `results/` or on the board. Each folder
holds the attempt in the same files as a counted trial (`trial.json`, `grade.json`, `trajectory.json`, ...) and a
`REASON.txt`. Folder names are the source run folders (`k1123s-g04-r0` is `k1123s/g04-r0`); the trial folder inside
uses Scale's 1-based run index.
| Attempt | Trial | Outcome | Why not counted | Replaced by |
|---|---|---|---|---|
| `k1123s-g04-r0` | cdb-g04-r1 | fail, terminal opened | old launch wording | `k1123s2/g04-r0` |
| `k1123s-g04-r1` | cdb-g04-r2 | fail, terminal opened | old launch wording | `k1123s2/g04-r1` |
| `k1123s-g04-r2` | cdb-g04-r3 | fail, terminal opened | old launch wording | `k1123s2/g04-r2` |
| `k1123s-g04-r3` | cdb-g04-r4 | fail, terminal opened | old launch wording | `k1123s2/g04-r3` |
| `k1123s2-g03-r0-credit402` | cdb-g03-r1 | fail, 402 at turn 17 | OpenRouter out of credits | `k1123s2/g03-r0` |
| `k1123s2-g03-r0-credit402b` | cdb-g03-r1 | fail, 402 on first call | OpenRouter out of credits | `k1123s2/g03-r0` |
| `k1123s2-g04-r3-credit402` | cdb-g04-r4 | fail, 402 at turn 16 | OpenRouter out of credits | `k1123s2/g04-r3` |
- **Old launch wording.** The Kubi MCP gave its launch example literally as "(calc, terminal)", and the agent started
a terminal from its app list. In all four CDB-G04 tries the agent opened GNOME Terminal within 10 to 26 s, and
trycua's GUI-only guard stopped it (exit 143, no `result` event, so no cost). kubi-platform 934e510 changed the
example to "(calc, files)"; those four trials were then run again on it, and the fifth, `cdb-g04-r5`, ran once, on
the new wording. All five counted Sonnet CDB-G04 trials had the new wording. Counting these four would score a
setup that no counted trial used for the rest of CDB-G04.
- **System prompt.** All five excluded CDB-G04 attempts, like the counted ones, were sent the bench's generic system
prompt with "Do not use the network."; Scale's CDB-G04 trials had "Do not use the internet; the task's localhost
site is allowed." in its place (see the README's Prompt section).
- **OpenRouter 402.** OpenRouter refused a request because the account's credits ran out, an infrastructure failure
unrelated to the agent or the driver, so the trial was run again with the same task and seed after credits were
added. Scale's equivalent is a harness error re-run (`attempts.json`); the counted trial's `harness_errors` counts
these.
- Two counted Sonnet trials also got a 402, after the task was already done (`cdb-g02-r2`, `cdb-g04-r3`). The
checker passed both and they stay counted as passes; see the README's run notes.
"""
README_TITLES = { # Scale's titles, shortened to fit a table cell
'IR-01': 'Two-step form, permission prompt between steps', 'IR-02': 'Set two fields, Apply under an update banner',
'IR-03': 'Edit two notes, unsaved-changes dialog', 'IR-04': 'Sign up, cookie-consent overlay'}
def write_docs(df, board_rows):
trials = {run: [json.load(open(f)) for f in sorted(glob.glob(str(HERE / 'runs/linux' / run / '*/trial.json')))]
for run in (HAIKU, SONNET)}
sc = SCALE_TRIALS[(SCALE_TRIALS.os == 'linux') & (SCALE_TRIALS.condition == 'foreground')]
on = sc[sc.on_board]
k = lambda g: f'{int(g.passed.sum())} of {len(g)}'
head = ['| Model | Kubi (this dataset) | Scale, cua-driver | Scale, agent-desktop |', '|---|---|---|---|']
for name, run, mid in (('Claude Haiku 5.5', HAIKU, 'haiku-5-5'), ('Claude Sonnet 5.5', SONNET, 'sonnet-5-5')):
g = on[on.model == f'anthropic/claude-{mid}']
head.append(f'| {name} | {k(df[df.run == run])} | {k(g[g.driver == "cua-driver"])} | {k(g[g.driver == "agent-desktop"])} |')
off = sc[~sc.on_board]
res = ['| Probe | Task | Haiku 5.5 | Sonnet 5.5 |', '|---|---|---|---|']
for t in LONG + SHORT:
c = [f'{int(df[(df.run == r) & (df.probe == t)].passed.sum())}/5' for r in (HAIKU, SONNET)]
res.append(f'| {t} | {README_TITLES.get(t, TITLES.get(t))} | {c[0]} | {c[1]} |')
runs = ['| Run | Mean cost, billed (USD) | Mean cost at Scale\'s Sonnet prices (USD) | Mean model calls | Median time (s) | GUI-only failures |',
'|---|---|---|---|---|---|']
nulls = []
for run in (HAIKU, SONNET):
T = trials[run]
cost = [t['cost_usd'] for t in T if t['cost_usd'] is not None]
sp = [t['kubi']['cost_usd_at_scale_sonnet_prices'] for t in T if t['kubi']['cost_usd_at_scale_sonnet_prices'] is not None]
dur = pd.Series([t['duration_s'] for t in T if t['duration_s'] is not None])
gui = sum(not t['grade']['gui_only']['result'] for t in T)
nulls += [f'{"Haiku" if run == HAIKU else "Sonnet"} `{t["trial_id"].replace("-foreground", "")}`' for t in T if t['cost_usd'] is None]
runs.append(f'| `{run}` | {sum(cost) / len(cost):.3f} ({len(cost)} trials) | '
+ (f'{sum(sp) / len(sp):.3f} ({len(sp)} trials)' if sp else 'n/a (Haiku)')
+ f' | {sum(t["model_calls"] for t in T) / len(T):.1f} | {dur.median():.1f} ({len(dur)} trials) | {gui} |')
tools = sorted({x for run in (HAIKU, SONNET) for f in glob.glob(str(HERE / 'runs/linux' / run / '*/trajectory.json'))
for x in json.load(open(f))[0].get('tools', [])})
assert len(tools) == 13, tools
txt = (README_MD.replace('@@HEADLINE@@', '\n'.join(head)).replace('@@RESULTS@@', '\n'.join(res))
.replace('@@RUNS@@', '\n'.join(runs))
.replace('@@NULLS@@', f'**{len(nulls)} trials have no cost or time** ({", ".join(nulls)}): the GUI-only guard '
'killed Claude Code before its `result` event. The means and medians above are over the other trials.')
.replace('@@TOOLS@@', ', '.join(f'`{x.split("__")[-1]}`' for x in tools))
.replace('@@OFF_H@@', k(off[off.run == 'haiku-5-5-2026-11-02'])).replace('@@OFF_S@@', k(off[off.run == 'sonnet-5-5-2026-11-03'])))
assert '@@' not in txt
(HERE / 'README.md').write_text(txt)
(HERE / 'excluded/EXCLUDED.md').write_text(EXCLUDED_MD)
def main():
for p in ['runs', 'results', 'tasks', 'licenses', 'assets']:
shutil.rmtree(HERE / p, ignore_errors=True)
for p in (HERE / 'excluded').glob('k1123*'): # excluded/EXCLUDED.md is rewritten at the end
shutil.rmtree(p)
trial_rows, call_rows, board_rows = [], [], []
screens = {HAIKU: set(), SONNET: set()}
tools = {}
for run, folder, wording in counted():
dest = HERE / 'runs/linux' / run
made, rj = convert(run, folder, wording, dest, trial_rows, call_rows, board_rows)
screens[run].add(rj['screen'])
for run in (HAIKU, SONNET):
s = SETUPS[run]
# the tool list the hosted MCP gave the agent (system/init), per launch wording
tl = sorted({t for f in glob.glob(str(HERE / 'runs/linux' / run / '*/trajectory.json'))
for t in json.load(open(f))[0].get('tools', []) if t.startswith('mcp__')})
(HERE / 'runs/linux' / run / 'manifest.json').write_text(json.dumps({
'run': run, 'os': 'linux', 'trials': 50,
'settings': [f'mcp={MCP}', 'effort=medium', 'MAX_THINKING_TOKENS=16000', 'tools=""', 'allowed-tools=mcp__kubi',
'provider=openrouter'],
'task_pack': {'repo': 'trycua/cua', 'commit': BENCH_COMMIT, 'sha256': None},
'bench': {'commit': BENCH_COMMIT, 'runner': 'launch/xfce_session.py (trycua) driven by kubi-platform api/scripts/cdb-bench.ts'},
'framework': None,
'model': s['model'],
'harness': {'name': 'claude-code', 'versions': [CLAUDE_CODE], 'effort': 'medium'},
'agents': ['default'], 'builtin_tools': [{'only': []}],
'prompt_budget_line': s['budget'],
'computers': {scr: {'computer': 'kubi screen (Linux, XFCE session of the bench)', 'driver': 'kubi',
'driver_version': f'kubi-host {KUBI_HOST}; api 0eade0e before 2026-11-23T14:20Z, 934e510 after',
'display': {'width': 1920, 'height': 1080}, 'mcp': MCP, 'tools': tl}
for scr in sorted(screens[run])},
}, indent=1) + '\n')
# excluded attempts, same files, under excluded/
ex_rows = []
for folder, why in EXCLUDED.items():
run = SONNET
wording = 'old' if folder.startswith('k1123s/') else 'calc, files'
dest = HERE / 'excluded' / folder.replace('/', '-')
convert(run, folder, wording, dest, ex_rows, [], [])
(dest / 'REASON.txt').write_text(why + '\n')
# tables, with Scale's columns and types
# Scale's Arrow schema, column for column, so pyarrow.concat_tables([scale, ours]) works; nulls stay null (object
# columns, not False), e.g. sentinel_ok and the A22 columns
cols = list(SCALE_TRIALS.columns)
schema = pq.read_schema(SCALE / 'trials.parquet').remove_metadata()
df = pd.DataFrame(trial_rows)[cols].astype(object)
df = df.where(df.notna(), None)
table = pa.Table.from_pandas(df, schema=schema, preserve_index=False).replace_schema_metadata(None)
(HERE / 'results').mkdir()
pq.write_table(table, HERE / 'results/trials.parquet')
df = table.to_pandas()
df.to_csv(HERE / 'results/trials.csv', index=False)
pd.DataFrame(board_rows).to_parquet(HERE / 'results/board.parquet', index=False)
calls = pd.DataFrame(call_rows)
calls.to_parquet(HERE / 'results/calls.parquet', index=False)
pd.DataFrame(columns=['run', 'os', 'name', 'task_file', 'run_index', 'kind', 'harness_errors']).to_parquet(
HERE / 'results/missing.parquet', index=False)
(HERE / 'results/snapshot.json').write_text(json.dumps({'built_at': datetime.now(timezone.utc).isoformat(timespec='seconds')}) + '\n')
# tasks: one row per trial task, per prompt setup
(HERE / 'tasks').mkdir()
sp = json.load(open(glob.glob(str(SRC / 'k1123/r0/*/run.json'))[0]))['system_prompt']
trows = []
for budget in (False, True):
for t in LONG + SHORT:
for i in ([0] if t in LONG else range(5)):
tl = t.lower()
tf = ('kubi-' if budget else 'kubi-nobudget-') + (f'{tl}-foreground' if t in LONG else f'{tl}-r{i + 1}-foreground')
trows.append(dict(task_file=tf, task=tl, probe=t, title=TITLES.get(t), condition='foreground',
run_index=None if t in LONG else float(i + 1),
seed=None if t in LONG else float(BRIEFS[(t, i)][0]), os='linux', driver='kubi',
computer='kubi screen', prompt=prompt(t, i, budget), system_prompt=sp,
builtin_tools=json.dumps({'only': []}), max_turns=45, timeout_s=360,
task_json=json.dumps({
'runner': 'kubi-platform api/scripts/cdb-bench.ts --run',
'session': f'python3 launch/xfce_session.py --task {t} --run-index <0-based run> --condition foreground --out <dir> --label kubi --timeout 360 -- /home/user/cdb/agent-kubi.sh',
'agent': f'claude -p "$(cat brief.md)" --model <model> --effort medium --mcp-config mcp.json --strict-mcp-config --tools "" --allowed-tools mcp__kubi --permission-mode bypassPermissions --setting-sources project --max-turns 45 --output-format stream-json --verbose' + (' (through claude-scale.sh: --append-system-prompt <system prompt>, budget line appended to -p)' if budget else ' (through claude-scale.sh: --append-system-prompt <system prompt>)'),
'env': {'MAX_THINKING_TOKENS': '16000', 'ANTHROPIC_BASE_URL': 'https://openrouter.ai/api'},
'used_by': HAIKU if not budget else SONNET}, indent=1)))
tasks = pd.DataFrame(trows)
tasks.to_parquet(HERE / 'tasks/tasks.parquet', index=False)
# licences and the comparison page
(HERE / 'licenses').mkdir()
for f in ('FSL-1.1-MIT.md', 'CC0-1.0.txt', 'Apache-2.0.txt'):
shutil.copy(SCALE / f, HERE / 'licenses' / f)
(HERE / 'assets').mkdir()
shutil.copy(SRC / 'report/index.html', HERE / 'assets/comparison.html')
write_docs(df, board_rows)
print('trials', len(df), df.groupby('run').passed.agg(['sum', 'count']).to_dict(), 'calls', len(calls),
'excluded', len(ex_rows), 'tasks', len(tasks))
print('redactions during build', REDACTIONS)
main()