fix(dashboard): offload PTY spawn/close off the event loop - #53227
Merged
Conversation
austinpickett
approved these changes
Jun 26, 2026
1 task
pai-scaffolde
pushed a commit
to pai-scaffolde/hermes-agent
that referenced
this pull request
Jun 28, 2026
…arch#53227) * Fix blocking tasks on the dashboard * Remove unnecessary comments
1 task
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
…arch#53227) * Fix blocking tasks on the dashboard * Remove unnecessary comments
This was referenced Jul 7, 2026
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
…arch#53227) * Fix blocking tasks on the dashboard * Remove unnecessary comments
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
…arch#53227) * Fix blocking tasks on the dashboard * Remove unnecessary comments
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…arch#53227) * Fix blocking tasks on the dashboard * Remove unnecessary comments
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Aug 2, 2026
- homeassistant_tool: _async_get_state (single entity), _async_call_service - dashboard_auth routes: api_auth_me (session JSON), login_page (next same-origin validation) - mcp_oauth: set_client_info (cold-start refresh persistence) - run: _prepare_profile_scoped_inbound_message_text (multiplex scope), _echo_pending_stt_transcripts_once (🎙️ once-flag), _send_goal_status_notice, _handle_reaction_event (hook fan-out), _finish_startup_restore (gather + drain) - yuanbao: dispatch_msg_body (lock + group:/direct: routing) - weixin: _maybe_fetch_typing_ticket (getConfig cache), _download_voice (.silk 60s), _download_image (aeskey hex→b64), _download_remote_media (SSRF gate + wait_for) - signal: remove_reaction (empty emoji + remove=True) - qqbot: _heartbeat_loop (op 1 @ 80% hello interval) - pty_session: attach_or_spawn (reuse/spawn off-loop NousResearch#53227)
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
…arch#53227) * Fix blocking tasks on the dashboard * Remove unnecessary comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The in-dashboard chat tab could make the entire dashboard slow and intermittently unreachable, other tabs would hang and the instance would flip to "reconnecting."
Root cause: the
/api/ptyWebSocket handler (pty_ws) did two blocking operations directly on the single asyncio/uvicorn event loop:PtyBridge.spawn(...)— forks + execs a full TUI child process (blocking) on every connect.bridge.close()— escalatesSIGHUP → SIGTERM → SIGKILLwith up to ~1.5 s of blocking waits on every teardown.Because the dashboard runs a single worker, each of these froze every other request, including the public
/api/statusliveness probe, for their duration. This was amplified by the PTY auto-reconnect added in #52962: a dropped chat socket now respawns the child, so on a resource-tight machine the connect/teardown cycle (and therefore the event-loop stalls) repeats, dragging the whole dashboard down.Type of Change
Changes Made
hermes_cli/web_server.py(pty_ws): wrapPtyBridge.spawn(argv, cwd=cwd, env=env)inawait asyncio.to_thread(...)so the fork+exec no longer blocks the event loop on connect.hermes_cli/web_server.py(pty_wsfinally): wrapbridge.close()inawait asyncio.to_thread(...)so the SIGHUP→SIGTERM→SIGKILL teardown (up to ~1.5 s) no longer blocks the event loop on disconnect.Code
Documentation & Housekeeping
docs/, docstrings) — N/A (no public surface change; added explanatory comments inline)cli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/Aasyncio.to_threadis stdlib/cross-platform; no platform-specific behavior changed