Skip to content

Commit 20c1dcd

Browse files
committed
experiment: classify hook warnings in deep dive
1 parent 27f06da commit 20c1dcd

1 file changed

Lines changed: 29 additions & 6 deletions

File tree

experiment/locality-mcp-comparison/scripts/deep-dive-report.py

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,20 @@ def usage_totals(summary: dict) -> dict:
9898
return buckets
9999

100100

101+
def non_warning_errors(summary: dict) -> list[str]:
102+
errors = summary.get("errors") or []
103+
return [
104+
error
105+
for error in errors
106+
if "--dangerously-bypass-hook-trust" not in str(error)
107+
]
108+
109+
110+
def warning_count(summary: dict) -> int:
111+
errors = summary.get("errors") or []
112+
return len(errors) - len(non_warning_errors(summary))
113+
114+
101115
def strategy_roots(root: Path) -> dict[str, Path]:
102116
candidates = {}
103117
artifacts = root / "artifacts"
@@ -271,7 +285,9 @@ def render_locality_trace_summary(lines: list[str], trace_summary: Path) -> None
271285
{
272286
"scenario": scenario,
273287
"strategy": strategy,
274-
"status": "errors" if codex_summary.get("errors") else "ok",
288+
"status": "errors"
289+
if non_warning_errors(codex_summary)
290+
else ("ok_with_warnings" if warning_count(codex_summary) else "ok"),
275291
"duration_ms": codex_summary.get("observed_duration_ms", 0),
276292
"events": codex_summary.get("event_count", 0),
277293
"tokens": tokens,
@@ -357,11 +373,11 @@ def render_locality_trace_summary(lines: list[str], trace_summary: Path) -> None
357373
tokens = usage_totals(codex_summary)
358374
lines.extend(
359375
[
360-
"| Codex observed | Events | Input | Cached input | Output | Reasoning output | Total tokens | Errors |",
361-
"| ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |",
376+
"| Codex observed | Events | Input | Cached input | Output | Reasoning output | Total tokens | Errors | Warnings |",
377+
"| ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |",
362378
f"| {fmt_ms(codex_summary.get('observed_duration_ms'))} | {codex_summary.get('event_count', 0)} | "
363379
f"{tokens['input']} | {tokens['cached_input']} | {tokens['output']} | {tokens['reasoning_output']} | "
364-
f"{tokens['total']} | {len(codex_summary.get('errors') or [])} |",
380+
f"{tokens['total']} | {len(non_warning_errors(codex_summary))} | {warning_count(codex_summary)} |",
365381
"",
366382
]
367383
)
@@ -397,12 +413,19 @@ def render_locality_trace_summary(lines: list[str], trace_summary: Path) -> None
397413
lines.append(f"| {label} | `{cell(rel(path))}` |")
398414
lines.append("")
399415

400-
if codex_summary.get("errors"):
416+
if non_warning_errors(codex_summary):
401417
lines.extend(["### Errors", ""])
402-
for error in codex_summary["errors"][:10]:
418+
for error in non_warning_errors(codex_summary)[:10]:
403419
lines.append(f"- {shorten(error, 240)}")
404420
lines.append("")
405421

422+
if warning_count(codex_summary):
423+
lines.extend(["### Warnings", ""])
424+
for error in (codex_summary.get("errors") or [])[:10]:
425+
if "--dangerously-bypass-hook-trust" in str(error):
426+
lines.append(f"- {shorten(error, 240)}")
427+
lines.append("")
428+
406429
if strategy == "locality":
407430
scenario_trace_summary = scenario_dir / "locality-agent-locality-trace-summary.json"
408431
render_locality_trace_summary(lines, scenario_trace_summary)

0 commit comments

Comments
 (0)