All 1,000 traces: three rebuilt from the controller log, marked as reconstructed
Browse filesAgents take their lane from the trace index when the release roster has none; reconstructed traces are flagged in the API and on agent pages and trace panels; the no-trace legend shows only when an agent has no trace.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Files changed (7)
- README.md+1-1
- app.py+6-6
- build/index_traces.py+7-4
- static/agents.js+6-4
- static/app.js+3-3
- static/style.css+1
- tests/test_api.py+6-1
28 unmodified lines2930313233343528 unmodified lines| PRs, reviews, commits, scores | release tables cut at commit `24cbc04` (2026-11-13T10:17:13Z) | `data/explorer.sqlite` || Board posts (184,059, 12 channels) | board export in `HuggingFaceSwarms/pybot-msgboard` (`data/`) | `data/explorer.sqlite`, FTS5 index || Diffs and files | git history in the dataset `HuggingFaceSwarms/pybot-commits` | bare clone at startup, `git show` || Agent traces (997 agents, 33 GB) | bucket `HuggingFaceSwarms/pybot-traces` | `data/traces.sqlite` time index + HTTP range reads |The same job also sums each agent's assistant messages (model calls, tool calls, input, output andreasoning tokens) in total and per hour; output tokens include reasoning tokens.28 unmodified lines2930313233343528 unmodified lines| PRs, reviews, commits, scores | release tables cut at commit `24cbc04` (2026-11-13T10:17:13Z) | `data/explorer.sqlite` || Board posts (184,059, 12 channels) | board export in `HuggingFaceSwarms/pybot-msgboard` (`data/`) | `data/explorer.sqlite`, FTS5 index || Diffs and files | git history in the dataset `HuggingFaceSwarms/pybot-commits` | bare clone at startup, `git show` || Agent traces (1,000 agents, 33 GB; 3 rebuilt from the controller's event log) | bucket `HuggingFaceSwarms/pybot-traces` | `data/traces.sqlite` time index + HTTP range reads |The same job also sums each agent's assistant messages (model calls, tool calls, input, output andreasoning tokens) in total and per hour; output tokens include reasoning tokens.
267 unmodified lines26826927027127227327427527627727860 unmodified lines33934034134234334434541 unmodified lines3873883893903913923932 unmodified lines3963973983994004014025 unmodified lines408409410411412413414267 unmodified lines@app.get("/api/prs/{n}/traces", summary="Trace windows linked to a PR (author and each reviewer)")def pr_traces(n: int):one("SELECT pr FROM prs WHERE pr = ?", n, what="PR")rows = q("""SELECT w.agent, w.role, w.from_ts, w.to_ts, a.lane, a.agent IS NOT NULL AS has_traceFROM pr_traces w LEFT JOIN t.trace_files a ON a.agent = w.agent WHERE w.pr = ?ORDER BY w.role, w.from_ts""", n)for r in rows:r["has_trace"] = bool(r["has_trace"])r["url"] = f"/api/traces/{r['agent']}?from={r['from_ts']}&to={r['to_ts']}"r["source"] = trace_url(r["lane"], r["agent"]) if r["has_trace"] else Nonereturn {"items": rows}60 unmodified linesbreakif next_cursor is not None:breakreturn {"agent": agent, "lane": f["lane"], "source": trace_url(f["lane"], agent), "from": from_, "to": to,"records": out, "next_cursor": next_cursor}41 unmodified linesreturn datetime.fromtimestamp(x, timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") if x is not None else NoneAGENT_COLS = """a.name, a.lane, f.agent IS NOT NULL AS has_trace, a.posts, a.prs_opened, a.prs_merged, a.reviews,s.model_calls, s.tool_calls, s.input_tokens, s.output_tokens, s.reasoning_tokens,s.input_tokens + s.output_tokens AS total_tokens, f.records, f.first_ts, f.last_ts"""AGENT_FROM = "agents a LEFT JOIN t.trace_files f ON f.agent = a.name LEFT JOIN t.agent_stats s ON s.agent = a.name"2 unmodified linesdef agent_row(r):r["has_trace"] = bool(r["has_trace"])r["first_ts"], r["last_ts"] = iso_epoch(r["first_ts"]), iso_epoch(r["last_ts"])r["source"] = trace_url(r["lane"], r["name"]) if r["has_trace"] else Nonereturn r5 unmodified lineslimit: int = Query(1000, ge=1, le=1000), offset: int = Query(0, ge=0)):if sort not in AGENT_SORTS:raise HTTPException(400, f"sort must be one of {sorted(AGENT_SORTS)}")rows = q(f"""SELECT {AGENT_COLS} FROM {AGENT_FROM} {"WHERE a.lane = ?" if lane else ""}ORDER BY {sort} IS NULL, {sort} {order}, a.name LIMIT ? OFFSET ?""", *([lane] if lane else []), limit + 1, offset)return page([agent_row(r) for r in rows], limit, offset)267 unmodified lines26826927027127227327427527627727860 unmodified lines33934034134234334434541 unmodified lines3873883893903913923932 unmodified lines3963973983994004014025 unmodified lines408409410411412413414267 unmodified lines@app.get("/api/prs/{n}/traces", summary="Trace windows linked to a PR (author and each reviewer)")def pr_traces(n: int):one("SELECT pr FROM prs WHERE pr = ?", n, what="PR")rows = q("""SELECT w.agent, w.role, w.from_ts, w.to_ts, a.lane, a.agent IS NOT NULL AS has_trace, a.reconstructedFROM pr_traces w LEFT JOIN t.trace_files a ON a.agent = w.agent WHERE w.pr = ?ORDER BY w.role, w.from_ts""", n)for r in rows:r["has_trace"], r["reconstructed"] = bool(r["has_trace"]), bool(r["reconstructed"])r["url"] = f"/api/traces/{r['agent']}?from={r['from_ts']}&to={r['to_ts']}"r["source"] = trace_url(r["lane"], r["agent"]) if r["has_trace"] else Nonereturn {"items": rows}60 unmodified linesbreakif next_cursor is not None:breakreturn {"agent": agent, "lane": f["lane"], "reconstructed": bool(f["reconstructed"]), "source": trace_url(f["lane"], agent), "from": from_, "to": to,"records": out, "next_cursor": next_cursor}41 unmodified linesreturn datetime.fromtimestamp(x, timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") if x is not None else NoneAGENT_COLS = """a.name, COALESCE(a.lane, f.lane) AS lane, f.agent IS NOT NULL AS has_trace, f.reconstructed, a.posts, a.prs_opened, a.prs_merged, a.reviews,s.model_calls, s.tool_calls, s.input_tokens, s.output_tokens, s.reasoning_tokens,s.input_tokens + s.output_tokens AS total_tokens, f.records, f.first_ts, f.last_ts"""AGENT_FROM = "agents a LEFT JOIN t.trace_files f ON f.agent = a.name LEFT JOIN t.agent_stats s ON s.agent = a.name"2 unmodified linesdef agent_row(r):r["has_trace"], r["reconstructed"] = bool(r["has_trace"]), bool(r["reconstructed"])r["first_ts"], r["last_ts"] = iso_epoch(r["first_ts"]), iso_epoch(r["last_ts"])r["source"] = trace_url(r["lane"], r["name"]) if r["has_trace"] else Nonereturn r5 unmodified lineslimit: int = Query(1000, ge=1, le=1000), offset: int = Query(0, ge=0)):if sort not in AGENT_SORTS:raise HTTPException(400, f"sort must be one of {sorted(AGENT_SORTS)}")rows = q(f"""SELECT {AGENT_COLS} FROM {AGENT_FROM} {"WHERE COALESCE(a.lane, f.lane) = ?" if lane else ""}ORDER BY {sort} IS NULL, {sort} {order}, a.name LIMIT ? OFFSET ?""", *([lane] if lane else []), limit + 1, offset)return page([agent_row(r) for r in rows], limit, offset)
26 unmodified lines272829303132333435363719 unmodified lines575859606162636 unmodified lines707172737475761 unmodified line7879808182838426 unmodified linesdef index_file(args):lane, agent, path = argsblocks, start, n, lo, hi, off = [], 0, 0, None, None, 0total, t = 0, Nonestats = [0, 0, 0, 0, 0] # model calls, tool calls, input, output, reasoning tokenshours = defaultdict(lambda: [0, 0, 0, 0]) # hour -> model calls, tool calls, input, output tokenswith open(path, "rb", buffering=8 << 20) as f:for line in f:m = TS.search(line, 0, 400)if m:t = epoch(m.group(1))19 unmodified linestotal += nlos = [b[4] for b in blocks if b[4] is not None]his = [b[5] for b in blocks if b[5] is not None]meta = (agent, lane, off, total, min(los) if los else None, max(his) if his else None)return meta, blocks, (agent, *stats), [(agent, hr, *v) for hr, v in sorted(hours.items())]6 unmodified linesprint(f"{len(jobs)} files", flush=True)db = sqlite3.connect(out)db.executescript("""CREATE TABLE trace_files(agent TEXT PRIMARY KEY, lane TEXT, size INT, records INT, first_ts REAL, last_ts REAL);CREATE TABLE trace_blocks(agent TEXT, offset INT, length INT, records INT, min_ts REAL, max_ts REAL);CREATE TABLE agent_stats(agent TEXT PRIMARY KEY, model_calls INT, tool_calls INT, input_tokens INT,output_tokens INT, reasoning_tokens INT);1 unmodified line""")with Pool(int(os.environ.get("WORKERS", "16"))) as pool:for i, (meta, blocks, stats, hours) in enumerate(pool.imap_unordered(index_file, jobs), 1):db.execute("INSERT INTO trace_files VALUES (?,?,?,?,?,?)", meta)db.executemany("INSERT INTO trace_blocks VALUES (?,?,?,?,?,?)", blocks)db.execute("INSERT INTO agent_stats VALUES (?,?,?,?,?,?)", stats)db.executemany("INSERT INTO agent_hours VALUES (?,?,?,?,?,?)", hours)26 unmodified lines2728293031323334353637383919 unmodified lines596061626364656 unmodified lines72737475767778791 unmodified line8182838485868726 unmodified linesdef index_file(args):lane, agent, path = argsblocks, start, n, lo, hi, off = [], 0, 0, None, None, 0total, t, rebuilt = 0, None, Falsestats = [0, 0, 0, 0, 0] # model calls, tool calls, input, output, reasoning tokenshours = defaultdict(lambda: [0, 0, 0, 0]) # hour -> model calls, tool calls, input, output tokenswith open(path, "rb", buffering=8 << 20) as f:for line in f:if off == 0: # traces rebuilt from the controller's event log say so in their session headerrebuilt = b'"reconstructed_from"' in linem = TS.search(line, 0, 400)if m:t = epoch(m.group(1))19 unmodified linestotal += nlos = [b[4] for b in blocks if b[4] is not None]his = [b[5] for b in blocks if b[5] is not None]meta = (agent, lane, off, total, min(los) if los else None, max(his) if his else None, int(rebuilt))return meta, blocks, (agent, *stats), [(agent, hr, *v) for hr, v in sorted(hours.items())]6 unmodified linesprint(f"{len(jobs)} files", flush=True)db = sqlite3.connect(out)db.executescript("""CREATE TABLE trace_files(agent TEXT PRIMARY KEY, lane TEXT, size INT, records INT, first_ts REAL, last_ts REAL,reconstructed INT);CREATE TABLE trace_blocks(agent TEXT, offset INT, length INT, records INT, min_ts REAL, max_ts REAL);CREATE TABLE agent_stats(agent TEXT PRIMARY KEY, model_calls INT, tool_calls INT, input_tokens INT,output_tokens INT, reasoning_tokens INT);1 unmodified line""")with Pool(int(os.environ.get("WORKERS", "16"))) as pool:for i, (meta, blocks, stats, hours) in enumerate(pool.imap_unordered(index_file, jobs), 1):db.execute("INSERT INTO trace_files VALUES (?,?,?,?,?,?,?)", meta)db.executemany("INSERT INTO trace_blocks VALUES (?,?,?,?,?,?)", blocks)db.execute("INSERT INTO agent_stats VALUES (?,?,?,?,?,?)", stats)db.executemany("INSERT INTO agent_hours VALUES (?,?,?,?,?,?)", hours)
70 unmodified lines71727374757641 unmodified lines1181191201211221231247 unmodified lines1321331341351361371381391401411421431441457 unmodified lines1531541551561571581 unmodified line16016116216316416516670 unmodified lines${ax.breaks.map(b => breakMark(x(b), 28)).join('')}</svg>`;}const SHORT = { conversation: 'convers.', uncertainty: 'uncert.', understanding: 'underst.', 'multi-turn': 'multi-t.', 'no trace': 'no trace' };function drawContrib(items) {41 unmodified lines.on('pointerleave blur', ev => { ev.target.classList.remove('on'); tip.style.opacity = 0; }).on('click keydown', (ev, a) => { if (ev.type === 'click' || ev.key === 'Enter') go(agentLink(a.name)); });}legend(color, vals.length ? [d3.min(vals), d3.max(vals)] : null);};chips.onclick = e => {const b = e.target.closest('button[data-m]');7 unmodified linesnew ResizeObserver(() => window.redrawChart === draw && draw()).observe(el);}function legend(color, range) {const el = document.getElementById('legend');if (!el || !range) return;const stops = d3.range(0, 1.01, 0.1).map(t => `<stop offset="${t}" stop-color="${color(Math.exp(Math.log(range[0]) + t * (Math.log(range[1]) - Math.log(range[0]))))}"/>`).join('');el.innerHTML = `<svg width="210" height="34" aria-hidden="true"><defs><linearGradient id="ramp">${stops}</linearGradient></defs><rect x="0" y="2" width="200" height="10" fill="url(#ramp)"/><text x="0" y="28">${fmt(range[0])}</text><text x="100" y="28" text-anchor="middle">log scale</text><text x="200" y="28" text-anchor="end">${fmt(range[1])}</text></svg><span class="nt"><svg width="11" height="11" aria-hidden="true"><rect width="11" height="11" fill="url(#hatch)"/></svg> no trace released</span>`;}// ---------- agent page ----------7 unmodified lines$app.innerHTML = `<div class="nav-row"><a data-nav href="/">← agents</a></div><div class="label">Agent · ${esc(a.lane || 'lane unknown')}</div><h1>${esc(a.name)}</h1><p class="meta-line">${a.has_trace ? `trace ${time(a.first_ts).slice(0, 16)} → ${time(a.last_ts).slice(0, 16)} · ${d3.format(',')(a.records)} records ·<a href="${a.source}" target="_blank" rel="noopener">trace file in the bucket ↗</a>` : 'no trace released for this agent'}</p><div class="meta">${stat('Model calls', fmt(a.model_calls))}${stat('Tool calls', fmt(a.tool_calls))}${stat('Input tokens', fmt(a.input_tokens))}1 unmodified line${stat('PRs opened / merged', `${a.prs_opened} / ${a.prs_merged}`)}${stat('Reviews given', fmt(a.reviews))}</div>${a.has_trace ? `<h2>Activity by hour</h2><div class="astrip" id="astrip"><div class="tip"></div></div><section class="tb"><header><button type="button" id="hprev" aria-label="Previous active hour">◀</button><h3 id="hlabel"></h3><button type="button" id="hnext" aria-label="Next active hour">▶</button></header><div class="turns" id="tturns"></div><button class="more" id="tmore" hidden>More</button></section>` : ''}<div class="alists"><section><h2>PRs · ${a.prs.length}</h2>${listCap(a.prs, p => `<div class="one"><a data-nav href="${p.merged_sha ? `/commits?sha=${p.merged_sha}` : `/pr/${p.pr}`}">#${p.pr}</a>70 unmodified lines7172737475767741 unmodified lines1191201211221231241257 unmodified lines1331341351361371381391401411421431441451467 unmodified lines1541551561571581591601 unmodified line16216316416516616716870 unmodified lines${ax.breaks.map(b => breakMark(x(b), 28)).join('')}</svg>`;}const RECON = '<span class="recon">reconstructed trace · may have gaps</span>';const SHORT = { conversation: 'convers.', uncertainty: 'uncert.', understanding: 'underst.', 'multi-turn': 'multi-t.', 'no trace': 'no trace' };function drawContrib(items) {41 unmodified lines.on('pointerleave blur', ev => { ev.target.classList.remove('on'); tip.style.opacity = 0; }).on('click keydown', (ev, a) => { if (ev.type === 'click' || ev.key === 'Enter') go(agentLink(a.name)); });}legend(color, vals.length ? [d3.min(vals), d3.max(vals)] : null, items.some(a => !a.has_trace));};chips.onclick = e => {const b = e.target.closest('button[data-m]');7 unmodified linesnew ResizeObserver(() => window.redrawChart === draw && draw()).observe(el);}function legend(color, range, untraced) {const el = document.getElementById('legend');if (!el || !range) return;const stops = d3.range(0, 1.01, 0.1).map(t => `<stop offset="${t}" stop-color="${color(Math.exp(Math.log(range[0]) + t * (Math.log(range[1]) - Math.log(range[0]))))}"/>`).join('');el.innerHTML = `<svg width="210" height="34" aria-hidden="true"><defs><linearGradient id="ramp">${stops}</linearGradient></defs><rect x="0" y="2" width="200" height="10" fill="url(#ramp)"/><text x="0" y="28">${fmt(range[0])}</text><text x="100" y="28" text-anchor="middle">log scale</text><text x="200" y="28" text-anchor="end">${fmt(range[1])}</text></svg>${untraced ? '<span class="nt"><svg width="11" height="11" aria-hidden="true"><rect width="11" height="11" fill="url(#hatch)"/></svg> no trace released</span>' : ''}`;}// ---------- agent page ----------7 unmodified lines$app.innerHTML = `<div class="nav-row"><a data-nav href="/">← agents</a></div><div class="label">Agent · ${esc(a.lane || 'lane unknown')}</div><h1>${esc(a.name)}</h1>${a.reconstructed ? RECON : ''}<p class="meta-line">${a.has_trace ? `trace ${time(a.first_ts).slice(0, 16)} → ${time(a.last_ts).slice(0, 16)} · ${d3.format(',')(a.records)} records ·<a href="${a.source}" target="_blank" rel="noopener">trace file in the bucket ↗</a>` : 'no trace released for this agent'}</p><div class="meta">${stat('Model calls', fmt(a.model_calls))}${stat('Tool calls', fmt(a.tool_calls))}${stat('Input tokens', fmt(a.input_tokens))}1 unmodified line${stat('PRs opened / merged', `${a.prs_opened} / ${a.prs_merged}`)}${stat('Reviews given', fmt(a.reviews))}</div>${a.has_trace ? `<h2>Activity by hour</h2><div class="astrip" id="astrip"><div class="tip"></div></div><section class="tb"><header><button type="button" id="hprev" aria-label="Previous active hour">◀</button><h3 id="hlabel"></h3><button type="button" id="hnext" aria-label="Next active hour">▶</button>${a.reconstructed ? RECON : ''}</header><div class="turns" id="tturns"></div><button class="more" id="tmore" hidden>More</button></section>` : ''}<div class="alists"><section><h2>PRs · ${a.prs.length}</h2>${listCap(a.prs, p => `<div class="one"><a data-nav href="${p.merged_sha ? `/commits?sha=${p.merged_sha}` : `/pr/${p.pr}`}">#${p.pr}</a>
354 unmodified lines35535635735835936036180 unmodified lines44244344444544644744892 unmodified lines541542543544545546547354 unmodified linesbox.innerHTML = '<p class="muted">Loading…</p>';const x = w[i], { recs: all, end } = await lastTurns(x, 1200), recs = all.slice(-12);if (!ok()) return;box.innerHTML = `<p class="muted">${esc(x.agent)} · last ${recs.length} turns before ${x.role === 'author' ? 'the merge' : 'the review'} (${time(end).slice(11, 16)}); click a turn to open it· <a data-nav href="/commit/${ex.sha}?tab=traces">full trace →</a> · <a href="${x.source}" target="_blank" rel="noopener">trace file in the bucket ↗</a></p>` + (recs.map(miniTurn).join('') || '<p class="muted">No turns in this window.</p>');box.onclick = e => { const t = e.target.closest('.mturn'); if (t && !e.target.closest('a')) t.classList.toggle('open'); };};80 unmodified linespanel.innerHTML = `<p class="muted">The author's trace from ten minutes before the PR opened until it merged or closed, and each reviewer's trace within fifteen minutes of their review. Controller events are hidden.</p>` +w.items.map((x, i) => `<section class="window" data-i="${i}"><header><h3>${x.role}</h3><b>${esc(x.agent)}</b><span class="muted">${esc(x.lane || '')} · ${time(x.from_ts)} → ${time(x.to_ts)}</span>${x.source ? `<a href="${x.source}" target="_blank" rel="noopener">trace file ↗</a>` : ''}</header><div class="turns">${x.has_trace ? '<button class="load">Show trace</button>' : '<p class="muted">No trace for this agent.</p>'}</div></section>`).join('');panel.querySelectorAll('.window').forEach(sec => {92 unmodified lines// ---------- data sources ----------const SOURCES = [{ name: 'Agent traces', kind: 'Bucket', repo: 'HuggingFaceSwarms/pybot-traces', url: 'https://huggingface.co/buckets/HuggingFaceSwarms/pybot-traces',what: 'Every agent\'s session log: 997 agents, 51.1M records, ~33 GB of Pi JSONL (session header, system/user/assistant/tool-result messages, controller events). README and Apache-2.0 licence in the bucket.',layout: 'traces/<lane>/<agent>.jsonl · traces/_manifest.jsonl (one row per agent)',cmds: ['hf buckets cp hf://buckets/HuggingFaceSwarms/pybot-traces/traces/_manifest.jsonl .','hf buckets cp hf://buckets/HuggingFaceSwarms/pybot-traces/traces/answers/agile-gorilla.jsonl .',354 unmodified lines35535635735835936036180 unmodified lines44244344444544644744892 unmodified lines541542543544545546547354 unmodified linesbox.innerHTML = '<p class="muted">Loading…</p>';const x = w[i], { recs: all, end } = await lastTurns(x, 1200), recs = all.slice(-12);if (!ok()) return;box.innerHTML = (x.reconstructed ? RECON : '') + `<p class="muted">${esc(x.agent)} · last ${recs.length} turns before ${x.role === 'author' ? 'the merge' : 'the review'} (${time(end).slice(11, 16)}); click a turn to open it· <a data-nav href="/commit/${ex.sha}?tab=traces">full trace →</a> · <a href="${x.source}" target="_blank" rel="noopener">trace file in the bucket ↗</a></p>` + (recs.map(miniTurn).join('') || '<p class="muted">No turns in this window.</p>');box.onclick = e => { const t = e.target.closest('.mturn'); if (t && !e.target.closest('a')) t.classList.toggle('open'); };};80 unmodified linespanel.innerHTML = `<p class="muted">The author's trace from ten minutes before the PR opened until it merged or closed, and each reviewer's trace within fifteen minutes of their review. Controller events are hidden.</p>` +w.items.map((x, i) => `<section class="window" data-i="${i}"><header><h3>${x.role}</h3><b>${esc(x.agent)}</b><span class="muted">${esc(x.lane || '')} · ${time(x.from_ts)} → ${time(x.to_ts)}</span>${x.reconstructed ? RECON : ''}${x.source ? `<a href="${x.source}" target="_blank" rel="noopener">trace file ↗</a>` : ''}</header><div class="turns">${x.has_trace ? '<button class="load">Show trace</button>' : '<p class="muted">No trace for this agent.</p>'}</div></section>`).join('');panel.querySelectorAll('.window').forEach(sec => {92 unmodified lines// ---------- data sources ----------const SOURCES = [{ name: 'Agent traces', kind: 'Bucket', repo: 'HuggingFaceSwarms/pybot-traces', url: 'https://huggingface.co/buckets/HuggingFaceSwarms/pybot-traces',what: 'Every agent\'s session log: 1,000 agents (3 rebuilt from the controller\'s event log, which may have gaps), 51.3M records, ~33 GB of Pi JSONL (session header, system/user/assistant/tool-result messages, controller events). README and Apache-2.0 licence in the bucket.',layout: 'traces/<lane>/<agent>.jsonl · traces/_manifest.jsonl (one row per agent)',cmds: ['hf buckets cp hf://buckets/HuggingFaceSwarms/pybot-traces/traces/_manifest.jsonl .','hf buckets cp hf://buckets/HuggingFaceSwarms/pybot-traces/traces/answers/agile-gorilla.jsonl .',
203 unmodified lines204205206207208209203 unmodified lines.tb { border: 1px solid var(--text-color); margin-top: 12px; }.tb > header { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--faint-color); background: var(--surface-bg); }.tb > header button { padding: 2px 8px; }.tb > header button:disabled { opacity: .35; cursor: default; }.tb .turns { padding: 8px 10px; max-height: 70vh; overflow-y: auto; }.alists { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }203 unmodified lines204205206207208209210203 unmodified lines.tb { border: 1px solid var(--text-color); margin-top: 12px; }.tb > header { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--faint-color); background: var(--surface-bg); }.tb > header button { padding: 2px 8px; }.recon { display: inline-block; font-size: 11px; color: var(--primary-color); border: 1px solid var(--primary-color); padding: 0 6px; margin: 2px 0; }.tb > header button:disabled { opacity: .35; cursor: default; }.tb .turns { padding: 8px 10px; max-height: 70vh; overflow-y: auto; }.alists { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
53 unmodified lines54555657585959 unmodified lines11912012112212312412553 unmodified lines{"type": "message", "timestamp": f"2026-11-01T09:{m:02d}:00.000Z","message": {"role": "assistant", "content": [{"type": "text", "text": f"step {m}"}, {"type": "toolCall", "name": "bash"}],"usage": {"input": 100, "output": 10, "reasoning": 4}}} for m in range(0, 60, 5)])jsonl(tmp / "manifest.jsonl", [{"lane": "lane1", "agent": "ann", "kept": 13, "bytes_out": 1, "last_record": "x"}])data = tmp / "data"; data.mkdir()import build_db, index_traces59 unmodified linesc, sha = clientrows = {a["name"]: a for a in c.get("/api/agents?sort=model_calls").json()["items"]}assert rows["ann"]["model_calls"] == 12 and rows["ann"]["tool_calls"] == 12 and rows["ann"]["total_tokens"] == 12 * 110assert rows["bob"]["has_trace"] is False and rows["bob"]["reviews"] == 1 and rows["ann"]["prs_merged"] == 1a = c.get("/api/agents/ann").json()assert a["hours"]["rows"][0][1:] == [12, 12, 1200, 120] and a["busiest_hour"] == "2026-11-01T09:00:00Z"h = c.get("/api/highlights").json()53 unmodified lines54555657585960616259 unmodified lines12212312412512612712812913053 unmodified lines{"type": "message", "timestamp": f"2026-11-01T09:{m:02d}:00.000Z","message": {"role": "assistant", "content": [{"type": "text", "text": f"step {m}"}, {"type": "toolCall", "name": "bash"}],"usage": {"input": 100, "output": 10, "reasoning": 4}}} for m in range(0, 60, 5)])(tmp / "traces" / "lane2").mkdir() # bob's trace was rebuilt from the controller log; the manifest has no lane for himjsonl(tmp / "traces" / "lane2" / "bob.jsonl", [{"type": "session", "timestamp": "2026-11-01T08:00:00.000Z","reconstructed_from": "controller event log (may have gaps)"}])jsonl(tmp / "manifest.jsonl", [{"lane": "lane1", "agent": "ann", "kept": 13, "bytes_out": 1, "last_record": "x"}])data = tmp / "data"; data.mkdir()import build_db, index_traces59 unmodified linesc, sha = clientrows = {a["name"]: a for a in c.get("/api/agents?sort=model_calls").json()["items"]}assert rows["ann"]["model_calls"] == 12 and rows["ann"]["tool_calls"] == 12 and rows["ann"]["total_tokens"] == 12 * 110assert rows["bob"]["reconstructed"] and rows["bob"]["lane"] == "lane2" and not rows["ann"]["reconstructed"]assert rows["bob"]["reviews"] == 1 and rows["ann"]["prs_merged"] == 1assert c.get("/api/prs/7/traces").json()["items"][1]["reconstructed"] is Truea = c.get("/api/agents/ann").json()assert a["hours"]["rows"][0][1:] == [12, 12, 1200, 120] and a["busiest_hour"] == "2026-11-01T09:00:00Z"h = c.get("/api/highlights").json()
README.md+1-1
app.py+6-6
build/index_traces.py+7-4
static/agents.js+6-4
static/app.js+3-3
static/style.css+1
tests/test_api.py+6-1