hermes-agent/tui_gateway
jinglun010 25a9c2c245 perf(cold-start): mitigate ~14s GIL stall during backend init (#60800)
Three fixes for the Desktop/TUI cold-start stall where the event loop
is blocked for ~14s between HERMES_BACKEND_READY and the first
prompt (#60800):

1. copilot_auth: skip  subprocess fallback when any
   Copilot env var is explicitly set (even if invalid). The user
   expressed token intent via env var; silently substituting a CLI
   token is surprising and the subprocess adds up to 5s on Windows.

2. tui_gateway/ws: run resolve_skin() via asyncio.to_thread so config
   loading + skin engine init do not block the WS read loop during
   the cold-start RPC burst.

3. web_server: extend _warm_gateway_module to pre-import the heavy
   module chains (auth, copilot_auth, runtime_provider, skin_engine,
   inventory, model_switch) that the first WS connection + RPC burst
   would otherwise import on the loop thread. These trigger .pyc
   compilation and Defender scans on Windows (15-30s per the existing
   comment) and were not covered by the original gateway-only warm.

Tests: 5 new tests in test_cold_start_gil_stall.py + 2 new tests in
test_copilot_auth.py. All 36 copilot_auth tests + 16 ws/web_server
tests pass.
2026-08-03 21:16:09 +05:30
..
__init__.py
_stdin_recovery.py
compute_host.py
entry.py
event_publisher.py
git_probe.py
host_supervisor.py
loop_noise.py
method_ctx.py
methods_complete.py
methods_config.py
methods_prompt.py
methods_session.py refactor(state): fold simplify findings — reuse _insert_message_rows, share guards, chunk seeds 2026-08-03 20:43:38 +05:30
methods_tools.py
project_tree.py
render.py
server.py refactor(state): fold simplify findings — reuse _insert_message_rows, share guards, chunk seeds 2026-08-03 20:43:38 +05:30
slash_worker.py
synthetic_turn.py
transport.py
turn_marker.py
ws.py perf(cold-start): mitigate ~14s GIL stall during backend init (#60800) 2026-08-03 21:16:09 +05:30