Compare commits

...

1 Commits

Author SHA1 Message Date
STEP35
ba1ae02d32 fix(plugins): remove 8KB heuristic limit on memory-provider detection
Some checks failed
Nix / nix (ubuntu-latest) (pull_request) Failing after 22s
Nix Lockfile Check / nix-lockfile-check (pull_request) Failing after 25s
Contributor Attribution Check / check-attribution (pull_request) Failing after 48s
Supply Chain Audit / Scan PR for critical supply chain risks (pull_request) Successful in 42s
Tests / e2e (pull_request) Successful in 4m3s
Tests / test (pull_request) Failing after 46m23s
Nix / nix (macos-latest) (pull_request) Has been cancelled
The auto-coercion heuristic that detects memory provider plugins by
scanning for `register_memory_provider` or `MemoryProvider` in the
plugin's __init__.py was limited to the first 8192 bytes. Some
third-party memory plugins (e.g. mempalace) place the registration
call later in the file, causing the heuristic to miss them and load
them as general plugins — which crashes because PluginContext does
not expose `register_memory_provider`.

The fix is to read the entire file instead of a fixed-size prefix.
Plugin __init__.py files are small; the performance impact is
negligible. The same fix is applied to both the general plugin
auto-coercion (hermes_cli/plugins.py) and the memory-specific
discovery helper (plugins/memory/__init__.py).

Fixes #990 — mempalace plugin now auto-detected as exclusive and
routed to the memory provider discovery path correctly.
2026-04-29 20:17:07 -04:00
2 changed files with 2 additions and 2 deletions

View File

@@ -789,7 +789,7 @@ class PluginManager:
init_file = plugin_dir / "__init__.py"
if init_file.exists():
try:
source_text = init_file.read_text(errors="replace")[:8192]
source_text = init_file.read_text(errors="replace")
if (
"register_memory_provider" in source_text
or "MemoryProvider" in source_text

View File

@@ -58,7 +58,7 @@ def _is_memory_provider_dir(path: Path) -> bool:
if not init_file.exists():
return False
try:
source = init_file.read_text(errors="replace")[:8192]
source = init_file.read_text(errors="replace")
return "register_memory_provider" in source or "MemoryProvider" in source
except Exception:
return False