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 docs: note atexit re-finalization interaction in shutdown() docstring 2026-08-03 09:59:58 +05:30
entry.py
…
event_publisher.py
…
git_probe.py
…
host_supervisor.py
…
loop_noise.py
…
method_ctx.py
…
methods_complete.py feat(tui): rank the slash menu by the skills you actually use 2026-08-01 01:17:41 -05:00
methods_config.py fix(tui): rebind extracted config handler to shared indicator constants 2026-07-31 22:33:16 -07:00
methods_prompt.py fix(tui): fail closed when prompt.submit cannot persist history truncation 2026-08-02 12:18:40 +05:30
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 fix(secrets): scope tier-3 credential reads (teams_pipeline, deepinfra models, FAL/XAI/VERCEL/DAYTONA/GITHUB presence, HERMES_API_KEY display) 2026-08-02 10:04:48 -07:00
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 polish(mem): readonly config read, debug-level trim logs, loud frame test 2026-08-02 22:44:38 +05:30
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