fix(desktop): call discover_plugins() in _make_agent so plugin hooks fire in the desktop GUI - #60010
Closed
donneyluck wants to merge 1 commit into
Closed
Conversation
…fire in the desktop GUI The desktop app's conversation path goes through tui_gateway/server.py _make_agent(), which is invoked on every new WebSocket session from the Electron frontend. Unlike the TUI slash_worker path (which already has an explicit discover_plugins() call added for the same reason) and the oneshot/gateway paths, _make_agent() never called discover_plugins(), so any installed plugin's hooks (on_session_start, pre_llm_call, etc.) were silently never registered for desktop users. Fix: call discover_plugins() at the top of _make_agent(), immediately after the AIAgent import. discover_plugins() is idempotent — it is a no-op after the first call in a process — so this adds no overhead for subsequent agent creations in the same session. Verified by confirming plugin_registered and on_session_start log entries appear in the plugin's debug log after the fix, and that Clawd on Desk responds to desktop Hermes sessions.
Collaborator
Duplicate of #50787 — both add the same idempotent |
Contributor
|
Thanks for tracing the desktop/TUI plugin-registration path. This is an automated hermes-sweeper review; current
|
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.
Summary
Plugin hooks (
on_session_start,pre_llm_call,post_llm_call, etc.) never fire for users running the desktop GUI app.Root Cause
The desktop app's conversation path goes through
tui_gateway/server.py→_make_agent(), which is called for every new WebSocket session from the Electron frontend. Unlike the TUIslash_workerpath (which already has an explicitdiscover_plugins()call for the same reason — see the comment added in that file) and theoneshot/gatewaypaths,_make_agent()never calleddiscover_plugins().As a result, any installed plugin's hooks are silently never registered for desktop users.
Fix
Call
discover_plugins()at the top of_make_agent(), immediately afterfrom run_agent import AIAgent.discover_plugins()is idempotent — it no-ops after the first call per process — so this adds no overhead for subsequent agent creations in the same session.Verification
After applying the fix, the plugin's
plugin_registeredandon_session_startlog entries appear in the debug log (CLAWD_HERMES_DEBUG=1) when starting a desktop conversation — confirming hooks are now registered and firing.Tested with the Clawd on Desk plugin on Windows.