From a8c8c620809b0dcdbb26cbfd891fad5cea10791a Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Mon, 27 Apr 2026 05:30:37 -0700 Subject: [PATCH] fix: export Adapter alias + qualify bare runtime imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two compounding bugs from the post-#87 extraction: 1. adapter.py never aliased GeminiCLIAdapter to the contract name `Adapter`, which `molecule_runtime.adapters.get_adapter()` reads via `getattr(mod, "Adapter")`. Without it, every gemini-cli workspace startup fails preflight with "no `Adapter` class is exported". 2. Four bare imports of runtime modules (`from config`, `from executor_helpers` in adapter.py + cli_executor.py) never got qualified to `from molecule_runtime.X import Y`. They worked when the runtime was bundled into workspace/ where bare imports resolved against sibling files; in the standalone template repo they explode with ModuleNotFoundError. Same migration debt as fixed in claude-code template (commits 280e89c and e7dea39). The pattern across templates was sniffed out by tonight's wire-real E2E sweep; the OTHER 5 templates (langgraph, crewai, autogen, deepagents, openclaw) also need the Adapter alias added — file separately. langgraph + deepagents also have bare `from a2a_executor import LangGraphA2AExecutor` — same fix. Co-Authored-By: Claude Opus 4.7 (1M context) --- adapter.py | 7 +++++-- cli_executor.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/adapter.py b/adapter.py index e0f6c78..688b61b 100644 --- a/adapter.py +++ b/adapter.py @@ -77,7 +77,7 @@ class GeminiCLIAdapter(BaseAdapter): Also seeds GEMINI.md from system-prompt.md if GEMINI.md is absent, so the agent has role context on first boot. """ - from executor_helpers import get_mcp_server_path + from molecule_runtime.executor_helpers import get_mcp_server_path # -- MCP wiring -------------------------------------------------- gemini_dir = Path.home() / ".gemini" @@ -116,7 +116,7 @@ class GeminiCLIAdapter(BaseAdapter): async def create_executor(self, config: AdapterConfig) -> AgentExecutor: from cli_executor import CLIAgentExecutor - from config import RuntimeConfig + from molecule_runtime.config import RuntimeConfig rc = config.runtime_config if isinstance(rc, dict): @@ -139,3 +139,6 @@ class GeminiCLIAdapter(BaseAdapter): config_path=config.config_path, heartbeat=config.heartbeat, ) + + +Adapter = GeminiCLIAdapter diff --git a/cli_executor.py b/cli_executor.py index 0396c61..f5ceadd 100644 --- a/cli_executor.py +++ b/cli_executor.py @@ -38,8 +38,8 @@ from a2a.server.events import EventQueue # KI-009: a2a-sdk v1 renames a2a.utils → a2a.helpers from a2a.helpers import new_agent_text_message -from config import RuntimeConfig -from executor_helpers import ( +from molecule_runtime.config import RuntimeConfig +from molecule_runtime.executor_helpers import ( CONFIG_MOUNT, MEMORY_CONTENT_MAX_CHARS, WORKSPACE_MOUNT,