Skip to content

Commit b8010ba

Browse files
authored
Update render.py
1 parent 7261cf9 commit b8010ba

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

python_agent_harness/tui/render.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ def _strip_final_check(text: str) -> str:
137137
untouched. The agent loop still produces and stores the message
138138
unchanged; this only trims it from the TUI display.
139139
"""
140+
# Fast path: the regex below is expensive on large buffers (the live
141+
# stream row can be ~100K chars and is re-stripped every frame), so
142+
# gate it behind a cheap substring check. The header always contains
143+
# both words, so a miss means no block to strip.
144+
low = text.lower()
145+
if "final" not in low or "check" not in low:
146+
return text
140147
m = _FINAL_CHECK_RE.search(text)
141148
if m is not None:
142149
head = text[: m.start()].rstrip()

0 commit comments

Comments
 (0)