molecule-core/workspace/plugins_registry
Molecule AI Infra-Runtime-BE 2e0080fb0b
Some checks failed
Secret scan / Scan diff for credential-shaped strings (pull_request) Failing after 1s
sop-tier-check / tier-check (pull_request) Failing after 1s
audit-force-merge / audit (pull_request) Has been skipped
fix(workspace): register plugins_registry as sys.modules shim before loading adapters
KI-296 fix: when the PyPI-installed runtime (molecule-ai-workspace-runtime
0.1.129+) ships plugins_registry as molecule_runtime.plugins_registry (a
subpackage), plugin adapter files that do ``from plugins_registry import ...``
as a top-level name fail with ModuleNotFoundError because Python's import
system cannot find a top-level ``plugins_registry`` package.

The fix in plugins_registry/__init__.py:_load_module_from_path() registers
molecule_runtime.plugins_registry as ``plugins_registry`` in sys.modules
before exec'ing any plugin adapter file, so the top-level import resolves
correctly in both environments:
- PyPI wheel (molecule_runtime.plugins_registry → sys.modules["plugins_registry"])
- molecule-core workspace source (top-level workspace/plugins_registry already
  on sys.path; the setdefault is a no-op)

Submodules (builtins, protocol, raw_drop) are also registered so adapters
that import ``from plugins_registry.builtins import ...`` work without error.

Added test_load_module_from_path_registers_plugins_registry_sys_modules.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 14:55:05 +00:00
..
__init__.py fix(workspace): register plugins_registry as sys.modules shim before loading adapters 2026-05-10 14:55:05 +00:00
builtins.py feat(plugin): implement MCPServerAdaptor (issue #847) 2026-04-24 01:42:13 +00:00
protocol.py chore: open-source restructure — rename dirs, remove internal files, scrub secrets 2026-04-18 00:24:44 -07:00
raw_drop.py chore: open-source restructure — rename dirs, remove internal files, scrub secrets 2026-04-18 00:24:44 -07:00