fix(tui): avoid mount_before AttributeError by falling back to mount

This commit is contained in:
giveen
2026-01-20 12:36:22 -07:00
parent cabae0fcd6
commit 0219d8367f

View File

@@ -1794,7 +1794,12 @@ class PentestAgentTUI(App):
first = scroll.children[0] if scroll.children else None
msg = SystemMessage(f" Target: {target}")
if first:
scroll.mount_before(msg, first)
# Textual's ScrollableContainer may not implement
# mount_before across versions; fall back to mount.
try:
scroll.mount_before(msg, first)
except Exception:
scroll.mount(msg)
else:
scroll.mount(msg)
except Exception as e:
@@ -2419,7 +2424,10 @@ Be concise. Use the actual data from notes."""
first = scroll.children[0] if scroll.children else None
msg = SystemMessage(f" Target: {target}")
if first:
scroll.mount_before(msg, first)
try:
scroll.mount_before(msg, first)
except Exception:
scroll.mount(msg)
else:
scroll.mount(msg)
except Exception: