From 21be7025c584ea9b1d829e088b6049e259c6859a Mon Sep 17 00:00:00 2001 From: Guillaume Meyer Date: Sat, 16 May 2026 23:12:18 +0000 Subject: [PATCH] refactor(plugins): drop dead bundled-source guard in _discover_all_plugins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `if key in seen and source == "bundled": continue` check was unreachable: bundled is scanned before user, so `key in seen` can never be true while `source == "bundled"`. The "user overrides bundled" semantics are preserved automatically by the unconditional `seen[key] = …` on the user pass. Replaces the dead guard with a one-line comment explaining the overwrite semantics, so a future contributor adding a third source (e.g. project plugins) can see at a glance how ordering interacts with the dict-overwrite. Matches `PluginManager.discover_and_load`'s "user wins" rule. Spotted by Copilot in code review on #27161. Co-Authored-By: Claude Opus 4.7 (1M context) --- hermes_cli/plugins_cmd.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hermes_cli/plugins_cmd.py b/hermes_cli/plugins_cmd.py index 6fa3c59c7a3..1e1c3282bee 100644 --- a/hermes_cli/plugins_cmd.py +++ b/hermes_cli/plugins_cmd.py @@ -762,11 +762,12 @@ def _discover_all_plugins() -> list: except Exception: pass key = f"{prefix}/{d.name}" if prefix else manifest_name - if key in seen and source == "bundled": - continue src_label = source if source == "user" and (d / ".git").exists(): src_label = "git" + # Bundled is scanned before user, so the user pass overwrites + # bundled entries with the same key — matches + # PluginManager.discover_and_load's "user wins" semantics. seen[key] = (key, version, description, src_label, d) continue