fix(logger): default Console width=200 for non-TTY contexts

Rich's Console() falls back to width=80 when stdout isn't a TTY (Docker
container logs, CI, captured output). That truncates diagnostic lines
that carry structured fields like "[ANTIBOT] tier N/M proxy=... status=
validator=... reason=..." — exactly the information you want when
debugging anti-bot escalation from logs alone.

Setting width=200 only affects the non-TTY fallback; real terminals
still auto-detect their actual width. Pure ergonomics improvement for
cloud/container deployments where everyone reads logs via `docker logs`
or log aggregators rather than interactively.

(cherry picked from commit 398851562ca102d73f979d7ceab589079817cc0d)
This commit is contained in:
unclecode
2026-04-17 04:17:06 +00:00
parent 62c619d454
commit c06a3dcf56

View File

@@ -144,7 +144,11 @@ class AsyncLogger(AsyncLoggerBase):
self.verbose = verbose
# Default to stderr so log lines do not corrupt stdout-based protocols
# (e.g. MCP stdio transport, piped shell commands).
self.console = console if console is not None else Console(stderr=True)
# width=200: Rich's default falls back to 80 in non-TTY contexts
# (e.g. Docker `docker logs`, CI, captured stdout), which truncates
# useful diagnostic lines. TTYs still auto-detect actual terminal
# width; this only lifts the non-TTY fallback cap.
self.console = console if console is not None else Console(stderr=True, width=200)
# Create log file directory if needed
if log_file: