From aae797bc274d89b10a30689cb11774af99b7732a Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Sat, 12 Sep 2026 17:18:50 -0700 Subject: [PATCH] fix(bot-screen): truncate launcher.log on each start The log was opened in append mode and nothing rotated it; a long-lived gateway restarting its screen grew it without bound and the tail start() reports on failure mixed launches. Each start now owns the file. (cherry picked from commit ea1e3ac737b3d0b76afc5ec5373c5d3248207820) --- tools/bot_desktop/runtime.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/bot_desktop/runtime.py b/tools/bot_desktop/runtime.py index 7547eafd74..16e4569bfb 100644 --- a/tools/bot_desktop/runtime.py +++ b/tools/bot_desktop/runtime.py @@ -331,7 +331,8 @@ def _spawn_and_wait(sd: Path, num: int, wait_seconds: float) -> DesktopStatus: if (browser := dock_launch()) is not None: # first-run / default-browser dialogs would sit between the human and the bot's tabs child_env["HERMES_BD_BROWSER_EXEC"] = f"{browser[0]} --user-data-dir={browser[1]} --no-first-run --no-default-browser-check" - log = open(sd / "launcher.log", "ab") # noqa: SIM115 — handed to the child, closed by it + # Truncated per start: the log is a diagnostic for THIS launch, and nothing rotates it otherwise. + log = open(sd / "launcher.log", "wb") # noqa: SIM115 — handed to the child, closed by it proc = subprocess.Popen( # windows-footgun: ok — Linux-only runtime (is_supported_host) ["bash", str(_LAUNCHER)], env=child_env, stdin=subprocess.DEVNULL, stdout=log, stderr=log, start_new_session=True, close_fds=True)