The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cli): report unknown line deltas for content-free diffs instead of +0 -0
teknium19ca33680ea30
diff --git a/agent/turn_summary.py b/agent/turn_summary.pyindex b542daa0ea4..f4440afb50a 100644--- a/agent/turn_summary.py+++ b/agent/turn_summary.py@@ -151,7 +151,13 @@ def _extract_line_deltas(tool_name: str, result: Any) -> tuple[int, int] | None:diff = payload.get("diff")if not isinstance(diff, str) or not diff.strip():return None- return _count_diff_lines(diff)+ added, removed = _count_diff_lines(diff)+ # A diff that carries no +/- content lines (e.g. a bare hunk header) tells+ # us nothing — report it as unknown rather than rendering a misleading+ # "+0 -0" next to a real edit.+ if added == 0 and removed == 0:+ return None+ return added, removedclass TurnSummaryCollector:diff --git a/tests/agent/test_turn_summary.py b/tests/agent/test_turn_summary.pyindex 786a53abaa9..b3d96f85433 100644--- a/tests/agent/test_turn_summary.py+++ b/tests/agent/test_turn_summary.py@@ -344,3 +344,28 @@ def test_turn_summary_config_defaults_present():display = DEFAULT_CONFIG["display"]assert display["turn_summary"] is Trueassert display["spinner_token_flow"] is True+++def test_content_free_diff_reports_unknown_not_zero_zero():+ """A diff with no +/- content lines (bare hunk header) must render as an+ edit with UNKNOWN deltas, never a misleading '+0 -0'.++ Found by E2E-rendering the collector against realistic tool payloads: the+ unit suite only fed diffs that had real content lines.+ """+ from agent.turn_summary import TurnSummaryCollector++ c = TurnSummaryCollector()+ c.begin()+ c.record_tool("patch", result={"success": True, "diff": "@@ -1,3 +1,15 @@"})+ line = c.render(3.0)+ assert "edited 1 file" in line+ assert "+0 -0" not in line++ real = TurnSummaryCollector()+ real.begin()+ real.record_tool(+ "patch",+ result={"success": True, "diff": "--- a/x\n+++ b/x\n@@ -1 +1,2 @@\n-old\n+new\n+extra\n"},+ )+ assert "+2 -1" in real.render(1.0)