molecule-core/workspace-template/plugins_registry
Molecule AI Triage Operator 2c80f5fe82 fix(plugins_registry): deduplicate handlers in _deep_merge_hooks()
Unconditional list.extend() on repeated plugin install caused every
hook handler to be appended on each reinstall, leading to 3-4x duplicate
firings per event (PreToolUse, PostToolUse, Stop, etc.).

Fix: before appending each incoming handler, compute a fingerprint of
(matcher, frozenset-of-commands). Skip append if the fingerprint is
already present in the merged list. First-time installs are unaffected —
new handlers still land correctly.

Adds 7 unit tests covering: first install, double install, triple install,
different-matcher co-existence, different-command co-existence, existing
user hook preservation, and top-level key merge semantics.

Closes #566

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 05:22:00 +00:00
..
__init__.py initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
builtins.py fix(plugins_registry): deduplicate handlers in _deep_merge_hooks() 2026-04-17 05:22:00 +00:00
protocol.py initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
raw_drop.py initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00