Files
hermes-agent/hermes_cli
elight eabe837133 fix(web): run config schema build and egress status read off the event loop
GET /api/config/schema built its provider-option schema inline in the
async handler, so the per-request walk plus the plugin-name scan (which
ast.parses every .py in the candidate plugin dirs) ran on the uvicorn
event loop that also serves /api/ws and every other dashboard route.

Measured on a 898-field config: the call costs 3.6s cold (2.9s warm),
and the worst loop gap during the call equals the full call duration —
the loop is frozen for the whole request. Meanwhile the adjacent WS
keepalive pinger (gateway_wss.py) records its 'tick' and sends on that
same loop; the documented hazard is that a starved ping budget makes a
proxy drop a healthy local socket (#53773, #48445, #50005).

get_egress_status (GET /api/egress/status) in the same file had the
same inline shape: a synchronous config-block read on the loop
(71 ms in the audit class; small, but the same class of bug and the
house rule is to fix the whole class in one PR).

Both handlers now offload via config_scoped_to_thread, the same helper
their sibling get_config already uses (and status, webapp_access,
oauth, ops use theirs): asyncio.to_thread copies the contextvar context
across, so the per-profile config scope is preserved.

Regression tests assert thread identity, not latency: the work must
run on a thread where asyncio.get_running_loop() raises, mirroring
tests/hermes_cli/test_proxy_off_loop.py's rationale that latency on a
blocked loop cannot be measured. Both tests fail when either handler is
reverted to inline (verified).

Fixes #147036
2026-11-02 20:49:40 -05:00
..
…
2026-10-21 23:05:11 -04:00
…
2026-10-20 22:18:49 -04:00
…
…
…
…
…
…
…
…
…
…
…