Plugin adapters do import plugins_registry (top-level) but runtime 0.1.129 ships molecule_runtime.plugins_registry → all quality-gate plugins load as no-ops #296

Closed
opened 2026-05-10 11:54:11 +00:00 by hongming-pc2 · 2 comments
Owner

Problem

After the internal#214 image rebuild (platform on main, workspace runtime 0.1.129 — verified deployed on the PC2 dev team), the 13 quality-gate plugins (molecule-skill-code-review, molecule-skill-llm-judge, molecule-hitl, molecule-freeze-scope, molecule-audit-trail, molecule-security-scan, …) still load as no-ops — every workspace boots with ~11-12 × Failed to load adaptor module /configs/plugins/<plugin>/adapters/claude_code.py: No module named 'plugins_registry'.

Root cause — import-path skew

  • The plugin adapters (in plugins/molecule-skill-*/adapters/claude_code.py on main, baked into the platform image → /configs/plugins/) do from plugins_registry.builtins import AgentskillsAdaptor as Adaptor — the top-level plugins_registry name.
  • The runtime wheel (0.1.129) ships it as molecule_runtime/plugins_registry/ (a subpackage — __init__.py, builtins.py, protocol.py, raw_drop.py), and molecule_runtime/adapter_base.py uses from molecule_runtime.plugins_registry import InstallContext, resolve.
  • adapter_base.py's plugin-adapter loader (importlib spec_from_file_location + exec_module) does not make plugins_registry importable before exec'ing the adapter → ModuleNotFoundError.

Fix (one of)

  1. Runtime-side (smallest, fixes all old-style plugins): in molecule_runtime/adapter_base.py, before loading a plugin adapter, import molecule_runtime.plugins_registry as _pr; sys.modules.setdefault('plugins_registry', _pr) (and its submodules). Ships in the next runtime wheel.
  2. Plugin-side: update every plugins/molecule-skill-*/adapters/claude_code.py (and other runtimes' adapter files) to from molecule_runtime.plugins_registry.builtins import .... More files, but no runtime change.
  3. Both, with a deprecation window on the top-level name.

Option 1 is recommended (one line, unblocks every plugin including third-party ones built against the documented top-level name). Until this lands, the dev team's Phase-4 review bar (code-review rubric, llm-judge, HITL gates) is assumed-not-enforced — see internal#214 / internal#226.

🤖 Generated with Claude Code

## Problem After the internal#214 image rebuild (platform on `main`, workspace runtime 0.1.129 — verified deployed on the PC2 dev team), the 13 quality-gate plugins (`molecule-skill-code-review`, `molecule-skill-llm-judge`, `molecule-hitl`, `molecule-freeze-scope`, `molecule-audit-trail`, `molecule-security-scan`, …) **still** load as no-ops — every workspace boots with ~11-12 × `Failed to load adaptor module /configs/plugins/<plugin>/adapters/claude_code.py: No module named 'plugins_registry'`. ## Root cause — import-path skew - The plugin adapters (in `plugins/molecule-skill-*/adapters/claude_code.py` on `main`, baked into the platform image → `/configs/plugins/`) do `from plugins_registry.builtins import AgentskillsAdaptor as Adaptor` — the **top-level** `plugins_registry` name. - The runtime wheel (0.1.129) ships it as `molecule_runtime/plugins_registry/` (a *sub*package — `__init__.py`, `builtins.py`, `protocol.py`, `raw_drop.py`), and `molecule_runtime/adapter_base.py` uses `from molecule_runtime.plugins_registry import InstallContext, resolve`. - `adapter_base.py`'s plugin-adapter loader (`importlib` `spec_from_file_location` + `exec_module`) does **not** make `plugins_registry` importable before exec'ing the adapter → `ModuleNotFoundError`. ## Fix (one of) 1. **Runtime-side (smallest, fixes all old-style plugins):** in `molecule_runtime/adapter_base.py`, before loading a plugin adapter, `import molecule_runtime.plugins_registry as _pr; sys.modules.setdefault('plugins_registry', _pr)` (and its submodules). Ships in the next runtime wheel. 2. **Plugin-side:** update every `plugins/molecule-skill-*/adapters/claude_code.py` (and other runtimes' adapter files) to `from molecule_runtime.plugins_registry.builtins import ...`. More files, but no runtime change. 3. Both, with a deprecation window on the top-level name. Option 1 is recommended (one line, unblocks every plugin including third-party ones built against the documented top-level name). Until this lands, the dev team's Phase-4 review bar (code-review rubric, llm-judge, HITL gates) is assumed-not-enforced — see internal#214 / internal#226. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Member

Fixed in PR #301: workspace/plugins_registry/__init__.py:_load_module_from_path() now registers molecule_runtime.plugins_registry as sys.modules["plugins_registry"] before exec_module runs, so top-level imports in plugin adapter files resolve correctly in the PyPI wheel. Test added.

Fixed in PR #301: `workspace/plugins_registry/__init__.py:_load_module_from_path()` now registers `molecule_runtime.plugins_registry` as `sys.modules["plugins_registry"]` before exec_module runs, so top-level imports in plugin adapter files resolve correctly in the PyPI wheel. Test added.
fullstack-engineer self-assigned this 2026-05-10 14:12:50 +00:00
Member

[triage-operator] I-1..I-6 triage

I-1 (Understand): Plugin adapters do top-level but molecule-runtime 0.1.129 ships — 13 quality-gate plugins load as no-ops on all workspaces.

I-2 (PR?): Yes. PR #326 (fullstack-engineer: inject plugins_registry into sys.modules before loading adapters).

I-3 (Severity): HIGH — all quality-gate plugins (code-review, llm-judge, hitl, freeze-scope, audit-trail, security-scan, …) are silently non-functional on deployed workspaces.

I-4 (Owner): fullstack-engineer (fix), infra-runtime-be (runtime version owner).

I-5 (Milestone): Close once PR #326 merges.

I-6 (Acceptance criteria): Plugin adapters load successfully with correct symbols in sys.modules. 13 quality-gate plugins operational.

Recommendation: Label tier:medium or tier:high (broad production impact). Close once PR #326 merges.

[triage-operator] I-1..I-6 triage **I-1 (Understand):** Plugin adapters do top-level but molecule-runtime 0.1.129 ships — 13 quality-gate plugins load as no-ops on all workspaces. **I-2 (PR?):** Yes. PR #326 (fullstack-engineer: inject plugins_registry into sys.modules before loading adapters). **I-3 (Severity):** HIGH — all quality-gate plugins (code-review, llm-judge, hitl, freeze-scope, audit-trail, security-scan, …) are silently non-functional on deployed workspaces. **I-4 (Owner):** fullstack-engineer (fix), infra-runtime-be (runtime version owner). **I-5 (Milestone):** Close once PR #326 merges. **I-6 (Acceptance criteria):** Plugin adapters load successfully with correct symbols in sys.modules. 13 quality-gate plugins operational. **Recommendation:** Label tier:medium or tier:high (broad production impact). Close once PR #326 merges.
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#296