Skip to content

Commit 9bc6dfb

Browse files
committed
Revert "TUI: strip parenthetical FINAL CHECK labels; show Task complete marker"
This reverts commit 48be095.
1 parent bae5886 commit 9bc6dfb

2 files changed

Lines changed: 14 additions & 33 deletions

File tree

python_agent_harness/tui/render.py

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ def _tool_result_preview(content: str) -> str:
9191
#
9292
# The header must be bracketed or start its own line: that keeps prose
9393
# like "let me do the final check" from truncating a real reply.
94-
# "Goal:", "**Goal:**", "**Goal**:", "`Goal` :", and labels carrying a
95-
# parenthetical before the colon ("Evidence (re-verified):")
96-
_FC_LABEL = r"[*_`]*[ \t]*(?:\([^)\n]*\)[ \t]*)?:"
94+
_FC_LABEL = r"[*_`]*[ \t]*:" # "Goal:", "**Goal:**", "**Goal**:", "`Goal` :"
9795
_FC_HEADER = (
9896
r"(?:"
9997
r"(?:\*\*|__|#{1,6}[ \t]*)?" # decoration before a bracketed header
@@ -264,12 +262,7 @@ def _build_history_rows(self, full: bool = False) -> list[Any]:
264262
if stripped != body:
265263
body = stripped
266264
collapsed_reasoning = True
267-
stripped = _strip_final_check(body)
268-
# a reply that was ONLY the completion-check block
269-
# leaves nothing behind — surface a done marker so the
270-
# round doesn't render blank
271-
check_only = stripped != body and not stripped.strip()
272-
body = stripped
265+
body = _strip_final_check(body)
273266
if not full:
274267
body = _tail_lines(body, 12)
275268
if collapsed_reasoning:
@@ -295,9 +288,7 @@ def _build_history_rows(self, full: bool = False) -> list[Any]:
295288
params = ""
296289
label = f"tool: {tc.name}({params})" if params else f"tool: {tc.name}"
297290
rows.append(Text(f"▶ {label}", style="magenta"))
298-
if check_only:
299-
rows.append(Text("Task complete.", style="dim"))
300-
elif body.strip():
291+
if body.strip():
301292
rows.append(Markdown(f"**assistant:** {body}", style=ASSISTANT_STYLE))
302293
elif m.role == "tool":
303294
preview = _tool_result_preview(m.text())
@@ -347,12 +338,7 @@ def _stream_row(self) -> Text | None:
347338
"""Live stream row (cheap Text, tail-capped)."""
348339
with self.lock:
349340
stream = self.stream_text
350-
stripped = _strip_final_check(stream)
351-
if stripped != stream and not stripped:
352-
# the stream was only the completion-check block: replace
353-
# the (now hidden) bookkeeping with a done marker
354-
return Text("Task complete.", style="dim")
355-
stream = stripped
341+
stream = _strip_final_check(stream)
356342
if not stream:
357343
return None
358344
cap = self._visible_row_cap()

tests/tui/test_tui_render.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ def test_restored_injected_prompts_hidden(self):
220220
def test_nudge_and_final_check_hidden(self):
221221
"""Harness bookkeeping is hidden from the panel: the injected
222222
completion-nudge user prompt and the assistant's [FINAL CHECK]
223-
block never show up — a check-only reply renders as a "Task
224-
complete." marker instead, and a reply carrying real content
225-
keeps its content. The stored messages are untouched — the
226-
agent loop keeps working exactly as before."""
223+
block never show up — even when the check block is the reply's
224+
ONLY content (a reply carrying real content keeps its content).
225+
The stored messages are untouched — the agent loop keeps
226+
working exactly as before."""
227227
from python_agent_harness import config
228228

229229
tui, buf = make_tui()
@@ -247,11 +247,10 @@ def test_nudge_and_final_check_hidden(self):
247247
self.assertIn("build the thing", out)
248248
self.assertIn("Done. All tests pass.", out)
249249
# the [FINAL CHECK] block is hidden even when it is the whole
250-
# reply — a check-only message renders as the done marker
250+
# reply — check-only messages never render
251251
self.assertNotIn("FINAL CHECK", out)
252252
self.assertNotIn("Status: SUCCESS", out)
253253
self.assertNotIn(config.NUDGE_MESSAGE, out)
254-
self.assertIn("Task complete.", out)
255254
# the agent loop's history is untouched
256255
self.assertEqual(
257256
tui.session.last_messages[1].text(),
@@ -281,15 +280,13 @@ def test_final_check_markdown_variants_hidden(self):
281280
"[FINAL CHECK]\n- **Goal:** g\n- **Status:** SUCCESS\n- **Evidence:** e",
282281
"## Final Check\n\n- Goal: g\n- Status: SUCCESS\n- Evidence: e\n",
283282
"answer.\n\n[Final check]\n* `Goal`: g\n* `Status`: SUCCESS\n* `Evidence`: e",
284-
"answer.\n\n[FINAL CHECK]\n- Goal: g\n- Status: SUCCESS\n- Evidence (re-verified): e",
285283
]
286284
for text in variants:
287285
with self.subTest(text=text):
288286
self.assertNotIn("Goal", _strip_final_check(text))
289287
# no dangling markdown decoration left behind
290288
self.assertNotIn("*", _strip_final_check(text))
291289
# a reply's real content survives the strip
292-
self.assertEqual(_strip_final_check(variants[-2]), "answer.")
293290
self.assertEqual(_strip_final_check(variants[-1]), "answer.")
294291

295292
def test_final_check_prose_mention_kept(self):
@@ -323,16 +320,14 @@ def test_final_check_without_header_kept(self):
323320
self.assertIn("Status: SUCCESS", out)
324321
self.assertIn("Evidence:", out)
325322

326-
def test_stream_pure_final_check_shows_marker(self):
327-
"""A stream that is only the [FINAL CHECK] block renders the
328-
done marker instead of flashing bookkeeping or going blank."""
323+
def test_stream_pure_final_check_hidden(self):
324+
"""A stream that is only the [FINAL CHECK] block never renders
325+
— the row goes blank on the final reply instead of flashing
326+
bookkeeping."""
329327
tui, _ = make_tui()
330328
tui.stream_text = "[FINAL CHECK]\n- Goal: x\n- Status: SUCCESS\n- Evidence: y"
331329
row = tui._stream_row()
332-
self.assertIsNotNone(row)
333-
self.assertIn("Task complete.", row.plain)
334-
self.assertNotIn("FINAL CHECK", row.plain)
335-
self.assertNotIn("Status: SUCCESS", row.plain)
330+
self.assertIsNone(row)
336331

337332
def test_reasoning_streams_normally(self):
338333
"""While streaming, reasoning content shows up live like any

0 commit comments

Comments
 (0)