From 01598bd7082a9a629e3d3b38bd0ed3bd55bbd7ef Mon Sep 17 00:00:00 2001 From: dullfig Date: Sun, 11 Jan 2026 14:33:29 -0800 Subject: [PATCH] Remove fallback print from response handler to debug TUI output --- handlers/hello.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/handlers/hello.py b/handlers/hello.py index e1ab1e6..4f734b9 100644 --- a/handlers/hello.py +++ b/handlers/hello.py @@ -130,17 +130,18 @@ async def handle_response_print(payload: ShoutedResponse, metadata: HandlerMetad try: from run_organism import get_console console = get_console() - except ImportError: - pass + except ImportError as e: + console = None - if console and hasattr(console, 'on_response'): - try: - console.on_response("shouter", payload) - return # Success - don't fall through to print - except Exception as e: - # Debug: show error but continue to fallback - print(f"\n\033[31m[console error] {e}\033[0m") + if console is not None: + if hasattr(console, 'on_response'): + try: + console.on_response("shouter", payload) + return # Success - exit without fallback print + except Exception as e: + pass # Fall through to fallback + # Console exists but no on_response - shouldn't happen - # Fallback: print to stdout (only if console not available or failed) - print(f"\n\033[36m[response] {payload.message}\033[0m") + # Fallback only runs if console is None + # This should NOT print if TUI is running return None