1 parent 7261cf9 commit b8010baCopy full SHA for b8010ba
1 file changed
python_agent_harness/tui/render.py
@@ -137,6 +137,13 @@ def _strip_final_check(text: str) -> str:
137
untouched. The agent loop still produces and stores the message
138
unchanged; this only trims it from the TUI display.
139
"""
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
147
m = _FINAL_CHECK_RE.search(text)
148
if m is not None:
149
head = text[: m.start()].rstrip()
0 commit comments