brooklyn!
5db1430af9
fix(windows): stop terminal-window popups from background spawns ( #53810 )
...
* fix(windows): stop terminal-window popups from background spawns
Native-Windows desktop/gateway users saw cmd/conhost windows flash on
gateway restart, image paste, the dashboard Projects tree, voice notes,
and ~5 min after closing the app (detached cron). Two root causes:
- Console-subsystem exes (taskkill, schtasks, wmic, netstat, tasklist,
agent-browser, git, ffmpeg, powershell, git-bash) spawned via raw
subprocess allocate a fresh console when the launching process has
none (pythonw desktop backend / detached gateway) - even with output
captured.
- uv venv pythonw shims re-exec console python.exe, so Python children
get a console regardless of how they're launched.
Fixes:
- Single hidden-spawn primitive (_subprocess_compat.run/.popen) that ORs
CREATE_NO_WINDOW on Windows, no-op on POSIX. Route every Hermes-owned
console-exe spawn through it.
- FreeConsole() catch-all in hermes_bootstrap: any Python child that
exclusively owns an auto-allocated console detaches it at startup
(GetConsoleProcessList()==1 gate leaves shared interactive consoles
untouched).
- Replace PowerShell/wmic gateway PID scans with in-process psutil.
- Skip schtasks queries on non-interactive desktop restarts.
- Prefer native agent-browser .exe over .cmd shims.
- Guard test bans raw subprocess spawns of the Windows-only console
tools repo-wide so the popup class can't regress.
* fix(windows): scope FreeConsole to background entry points; fix merge fallout
Console detach review (per #53810 feedback): GetConsoleProcessList()==1 can't
tell a uv pythonw->python phantom console apart from a user opening the
interactive CLI/TUI in its own fresh console (double-click, shortcut, ConPTY) —
both report a single attached process with a tty. Running FreeConsole() in the
import-time bootstrap therefore risked detaching a legitimately-interactive
terminal.
- Extract FreeConsole into explicit hermes_bootstrap.detach_orphan_console();
remove it from apply_windows_utf8_bootstrap() (import side effect).
- Call it only from known background mains: gateway run, dashboard backend
(start_server, what the desktop spawns), cron standalone, tui_gateway entry,
slash worker. Interactive CLI/TUI never calls it.
- Behavior-contract tests: frees only when solo owner, leaves shared console,
no-op without console / on POSIX, and asserts it's not an import side effect.
Merge fallout from origin/main (#53791 ):
- local.py: 3-way merge left a dangling **_popen_kwargs (NameError crashing
every terminal init). _subprocess_compat.popen already hides the window, so
drop it.
- discord adapter: merge stacked an undefined windows_hide_flags() onto the
primitive call; drop the redundant arg.
- test_gateway: scan now goes psutil-first (zero spawn); rewrite the
case-variant test to drive that production path.
* test(claw): mock _subprocess_compat.run seam for Windows process scan
claw.py's Windows tasklist/powershell scan routes through the hidden-spawn
primitive; the tests still patched claw_mod.subprocess, so on win32 the mock
was never hit and real spawns returned nothing. Patch the actual seam.
2026-06-27 14:02:24 -07:00
..
2026-05-27 02:12:27 -07:00
2026-06-08 22:54:25 -07:00
2026-06-24 00:54:18 +05:30
2026-05-28 22:26:25 -07:00
2026-05-25 01:20:33 -07:00
2026-06-09 14:45:19 -07:00
2026-06-04 05:53:35 -07:00
2026-04-26 05:43:31 -07:00
2026-06-15 05:36:20 +00:00
2026-05-27 00:43:32 -07:00
2026-05-28 22:26:25 -07:00
2026-04-21 14:31:48 -05:00
2026-06-01 09:57:10 -07:00
2026-06-23 23:28:21 -07:00
2026-06-17 05:48:35 -07:00
2026-06-13 05:15:26 -07:00
2026-06-21 19:53:27 -07:00
2026-05-28 22:26:25 -07:00
2026-06-09 23:21:24 -07:00
2026-06-25 00:11:15 -07:00
2026-06-04 16:54:40 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-04-24 03:00:33 -07:00
2026-05-08 14:27:40 -07:00
2026-05-24 04:25:32 -07:00
2026-06-15 05:40:23 -07:00
2026-05-18 20:01:34 -07:00
2026-05-18 10:14:38 -07:00
2026-05-28 22:26:25 -07:00
2026-06-26 19:23:33 +05:30
2026-05-28 15:14:05 +10:00
2026-05-15 14:45:43 -07:00
2026-05-28 22:26:25 -07:00
2026-06-27 11:45:07 -07:00
2026-05-28 22:26:25 -07:00
2026-06-19 01:53:32 +05:30
2026-06-19 01:53:32 +05:30
2026-06-19 01:53:32 +05:30
2026-05-28 15:14:05 +10:00
2026-05-28 22:26:25 -07:00
2026-06-27 14:02:24 -07:00
2026-05-28 22:26:25 -07:00
2026-06-08 15:12:12 -07:00
2026-05-25 01:20:33 -07:00
2026-06-12 13:42:42 -04:00
2026-06-23 18:42:05 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-06-10 00:24:06 -07:00
2026-05-28 22:26:25 -07:00
2026-05-17 02:29:41 -07:00
2026-06-23 23:49:22 -07:00
2026-05-13 09:34:15 -07:00
2026-04-21 14:23:45 -07:00
2026-05-28 22:26:25 -07:00
2026-04-17 19:03:26 -07:00
2026-05-28 22:26:25 -07:00
2026-06-27 03:23:22 -07:00
2026-04-29 23:18:55 -07:00
2026-06-24 16:34:51 +10:00
2026-06-21 16:31:56 +05:30
2026-05-28 22:26:25 -07:00
2026-04-28 01:18:09 -07:00
2026-04-24 05:09:08 -07:00
2026-05-29 23:45:05 -07:00
2026-04-24 05:09:08 -07:00
2026-06-23 23:39:22 -07:00
2026-06-11 05:01:25 +00:00
2026-06-23 23:29:50 -07:00
2026-06-21 22:43:55 -07:00
2026-05-28 22:26:25 -07:00
2026-05-09 18:43:40 -07:00
2026-05-07 05:27:47 -07:00
2026-05-07 05:27:47 -07:00
2026-06-07 18:21:03 -07:00
2026-06-07 18:21:03 -07:00
2026-06-01 16:58:58 -07:00
2026-06-01 16:58:58 -07:00
2026-04-25 18:47:53 -07:00
2026-06-13 05:51:05 -07:00
2026-06-06 01:29:41 +05:30
2026-06-18 09:40:56 -07:00
2026-06-26 19:15:18 -07:00
2026-05-27 02:12:27 -07:00
2026-05-28 22:26:25 -07:00
2026-06-26 19:15:18 -07:00
2026-06-26 19:15:18 -07:00
2026-06-26 19:15:18 -07:00
2026-05-27 02:12:27 -07:00
2026-06-26 19:15:18 -07:00
2026-05-27 02:12:27 -07:00
2026-06-26 19:15:18 -07:00
2026-05-27 02:12:27 -07:00
2026-06-26 19:15:18 -07:00
2026-06-02 23:43:27 -07:00
2026-04-30 06:43:22 -04:00
2026-06-04 03:03:35 -07:00
2026-05-12 13:59:22 -04:00
2026-06-09 13:56:33 +10:00
2026-06-27 10:08:13 +10:00
2026-06-06 12:43:28 -05:00
2026-06-15 15:33:15 +10:00
2026-06-19 07:05:42 -07:00
2026-06-02 20:49:44 -05:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-05-09 11:04:46 -07:00
2026-06-14 02:09:16 -07:00
2026-04-20 22:14:29 -07:00
2026-05-03 03:25:45 -07:00
2026-05-28 22:26:25 -07:00
2026-05-09 13:36:33 -07:00
2026-06-21 19:53:27 -07:00
2026-06-17 16:53:42 -07:00
2026-06-15 12:31:23 -07:00
2026-06-01 13:27:30 +10:00
2026-06-10 02:21:00 -07:00
2026-05-13 18:40:14 -07:00
2026-05-28 22:26:25 -07:00
2026-05-04 15:31:15 -04:00
2026-05-28 22:26:25 -07:00
2026-06-11 06:10:08 -07:00
2026-05-28 22:26:25 -07:00
2026-06-23 23:29:28 -07:00
2026-06-19 11:53:44 +05:30
2026-06-17 05:40:57 -07:00
2026-06-02 11:59:27 +10:00
2026-05-28 22:26:25 -07:00
2026-06-26 16:30:30 +05:30
2026-06-27 14:02:24 -07:00
2026-06-06 19:53:58 -07:00
2026-06-27 14:02:24 -07:00
2026-04-24 04:46:17 -07:00
2026-06-13 13:47:08 -07:00
2026-05-29 23:45:05 -07:00
2026-06-22 12:20:09 -07:00
2026-05-29 01:23:06 -07:00
2026-06-28 00:29:34 +05:30
2026-06-06 18:22:38 -07:00
2026-05-28 22:26:25 -07:00
2026-04-29 20:33:29 -07:00
2026-05-28 00:19:31 -07:00
2026-06-22 13:41:03 -07:00
2026-05-31 17:46:56 -05:00
2026-06-25 13:52:06 -07:00
2026-06-25 21:46:58 -07:00
2026-05-30 01:40:57 -07:00
2026-05-18 20:17:10 -07:00
2026-05-28 21:00:46 -07:00
2026-06-04 07:39:53 -07:00
2026-06-21 17:06:48 -07:00
2026-05-30 01:40:49 -07:00
2026-06-21 12:43:41 -07:00
2026-06-01 20:26:57 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 19:02:55 -07:00
2026-05-18 20:47:01 -07:00
2026-06-21 12:06:24 -07:00
2026-06-22 06:27:29 -07:00
2026-06-21 12:43:41 -07:00
2026-06-21 12:38:14 -07:00
2026-06-25 21:46:58 -07:00
2026-05-28 19:02:55 -07:00
2026-06-25 16:40:26 -05:00
2026-05-23 23:10:36 -07:00
2026-06-21 12:49:07 -07:00
2026-05-07 13:04:41 -07:00
2026-05-07 13:04:41 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 17:50:42 -07:00
2026-06-13 05:50:09 -07:00
2026-06-21 12:43:37 -07:00
2026-06-27 03:43:38 -07:00
2026-06-20 10:26:45 -07:00
2026-05-19 01:28:32 -07:00
2026-06-19 07:46:33 -07:00
2026-06-19 07:46:33 -07:00
2026-06-19 07:46:33 -07:00
2026-06-19 07:46:33 -07:00
2026-06-19 07:46:33 -07:00
2026-06-19 07:46:33 -07:00
2026-06-19 07:46:33 -07:00
2026-06-19 07:46:33 -07:00
2026-06-19 07:46:33 -07:00
2026-06-05 07:54:08 -05:00
2026-06-11 08:59:55 -07:00
2026-06-14 04:24:14 -07:00
2026-06-26 00:35:27 -07:00
2026-05-28 22:26:25 -07:00
2026-06-21 19:05:27 -07:00
2026-06-27 04:59:23 +05:30
2026-05-28 22:26:25 -07:00
2026-06-18 16:48:47 -05:00
2026-05-28 22:26:25 -07:00
2026-06-04 14:03:02 +10:00
2026-06-17 01:04:26 +08:00
2026-05-20 09:18:23 -07:00
2026-06-27 03:43:16 -07:00
2026-06-18 13:47:31 -07:00
2026-06-10 00:24:06 -07:00
2026-06-13 13:47:08 -07:00
2026-06-19 07:07:06 -07:00
2026-06-25 12:07:01 +05:30
2026-06-23 02:03:21 +05:30
2026-04-25 18:47:53 -07:00
2026-06-22 06:09:08 -07:00
2026-04-24 04:58:46 -07:00
2026-06-19 07:07:06 -07:00
2026-06-14 02:09:16 -07:00
2026-06-16 23:25:07 +05:30
2026-06-24 19:34:33 +05:30
2026-05-28 22:26:25 -07:00
2026-06-12 08:51:10 +00:00
2026-06-21 22:43:48 -07:00
2026-06-15 23:24:55 -05:00
2026-06-25 00:11:15 -07:00
2026-06-11 07:51:01 -07:00
2026-06-05 06:43:51 -07:00
2026-05-29 23:45:05 -07:00
2026-05-09 23:17:25 -07:00
2026-06-02 06:31:37 -07:00
2026-05-06 09:08:33 -07:00
2026-05-17 02:29:41 -07:00
2026-04-21 05:19:43 -07:00
2026-05-28 22:26:25 -07:00
2026-06-17 12:33:56 +05:30
2026-06-20 14:18:33 -05:00
2026-06-05 06:55:09 -07:00
2026-05-05 04:37:47 -07:00
2026-06-18 14:14:41 +10:00
2026-05-23 17:49:47 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-06-07 08:02:55 +00:00
2026-06-08 17:57:37 +05:30
2026-06-08 17:57:37 +05:30
2026-06-13 13:23:59 -07:00
2026-05-25 01:41:19 -07:00
2026-05-24 18:04:54 -07:00
2026-06-21 12:54:40 -07:00
2026-05-09 13:02:25 -07:00
2026-05-17 13:54:12 -07:00
2026-06-07 21:50:57 -07:00
2026-05-28 22:26:25 -07:00
2026-06-15 11:43:23 +10:00
2026-06-25 10:25:54 +10:00
2026-06-24 07:46:54 -07:00
2026-06-25 16:40:26 -05:00
2026-06-25 16:40:26 -05:00
2026-05-25 01:20:33 -07:00
2026-06-21 20:21:33 -07:00
2026-05-30 02:53:42 -07:00
2026-06-21 19:53:27 -07:00
2026-06-27 04:15:27 -07:00
2026-05-31 15:02:26 -07:00
2026-06-16 23:25:07 +05:30
2026-06-25 13:52:06 -07:00
2026-05-29 02:24:48 -07:00
2026-06-27 13:03:51 -07:00
2026-06-08 07:03:12 -07:00
2026-05-31 03:19:37 -07:00
2026-06-21 20:21:11 -07:00
2026-05-07 05:10:33 -07:00
2026-05-28 22:26:25 -07:00
2026-05-08 14:27:40 -07:00
2026-04-27 08:52:12 -07:00
2026-06-08 10:01:47 -07:00
2026-05-28 03:34:47 -07:00
2026-06-23 23:49:37 -07:00
2026-06-13 02:36:09 -07:00
2026-06-17 01:04:26 +08:00
2026-06-06 18:36:40 -07:00
2026-05-12 01:02:25 -07:00
2026-06-21 19:05:27 -07:00
2026-05-28 22:26:25 -07:00
2026-06-12 11:48:06 -07:00
2026-06-24 16:34:51 +10:00
2026-05-28 22:26:25 -07:00
2026-05-10 13:06:25 -07:00
2026-05-28 22:26:25 -07:00
2026-04-26 18:31:07 -07:00
2026-06-21 11:50:31 -07:00
2026-05-02 02:08:06 -07:00
2026-06-20 10:45:55 -07:00
2026-05-15 10:36:38 +05:30
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-06-01 16:58:58 -07:00
2026-06-05 04:06:17 -07:00
2026-05-28 22:26:25 -07:00
2026-06-08 09:42:44 -07:00
2026-05-19 01:28:32 -07:00
2026-05-25 01:20:33 -07:00
2026-05-31 09:13:06 -07:00
2026-06-24 17:56:30 +05:30
2026-05-28 11:59:58 -07:00
2026-06-14 22:54:54 +05:30
2026-06-10 01:02:40 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-06-23 11:30:10 -07:00
2026-06-20 23:23:47 -07:00
2026-05-08 16:07:23 -07:00
2026-06-10 21:39:22 -04:00
2026-06-04 01:19:28 +05:30
2026-06-17 12:55:40 +05:30
2026-06-07 22:56:23 -07:00
2026-06-18 12:01:54 +10:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-06-11 19:06:29 -04:00
2026-06-07 21:50:57 -07:00
2026-05-08 11:18:14 -07:00
2026-06-14 03:08:52 -07:00
2026-05-28 22:26:25 -07:00
2026-06-10 00:24:06 -07:00
2026-05-25 01:47:55 -07:00
2026-06-21 22:44:25 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00
2026-06-27 04:41:42 -07:00
2026-06-26 14:07:43 +05:30
2026-05-24 18:04:54 -07:00
2026-05-28 22:26:25 -07:00
2026-06-03 16:40:28 -07:00
2026-05-27 22:03:45 -05:00
2026-06-21 13:10:22 -07:00
2026-06-09 00:31:27 -07:00
2026-06-04 02:31:49 -07:00
2026-06-15 06:18:27 -07:00
2026-06-25 21:39:29 -06:00
2026-06-22 06:02:31 -07:00
2026-06-19 19:58:26 -07:00
2026-06-27 11:43:01 -07:00
2026-06-10 02:57:05 -07:00
2026-06-18 12:42:58 +05:30
2026-05-19 03:01:02 -07:00
2026-06-03 04:59:49 -07:00
2026-05-08 14:55:40 -07:00
2026-06-21 13:10:22 -07:00
2026-05-28 22:26:25 -07:00
2026-06-27 00:06:34 -07:00
2026-06-04 23:20:29 -04:00
2026-06-06 12:50:58 -05:00
2026-05-15 12:11:32 -07:00
2026-05-06 15:49:59 -07:00
2026-06-21 19:53:27 -07:00
2026-06-21 12:29:18 -07:00
2026-06-27 03:20:32 -07:00
2026-06-18 11:32:18 +05:30
2026-06-11 09:41:35 -07:00
2026-05-24 15:00:44 -07:00
2026-06-17 05:40:57 -07:00
2026-05-24 17:47:24 -07:00
2026-06-17 05:40:57 -07:00
2026-06-08 11:32:43 -07:00
2026-06-26 01:06:02 -07:00
2026-06-04 07:49:34 -07:00
2026-06-11 06:10:27 -07:00
2026-06-12 12:58:36 -07:00
2026-06-27 14:02:24 -07:00
2026-06-11 11:49:08 -07:00
2026-05-28 22:26:25 -07:00
2026-05-23 01:07:01 -04:00
2026-05-28 22:26:25 -07:00
2026-06-08 11:32:43 -07:00
2026-06-07 18:28:23 -07:00
2026-06-17 09:49:46 -07:00
2026-06-09 23:21:24 -07:00
2026-05-17 12:35:01 -07:00
2026-06-15 17:03:35 +05:30
2026-06-15 05:40:23 -07:00
2026-06-15 17:08:19 +05:30
2026-05-24 18:12:16 -07:00
2026-05-28 22:26:25 -07:00
2026-05-28 22:26:25 -07:00