mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
refactor(plugins): drop dead bundled-source guard in _discover_all_plugins
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) <noreply@anthropic.com>
This commit is contained in:
parent
8ab8bc2f03
commit
21be7025c5
1 changed files with 3 additions and 2 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue