From ad2aba5770584c3f6f4ff44a963fe79760527cef Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Thu, 30 Apr 2026 22:46:51 -0700 Subject: [PATCH] fix(adapter): skip gateway spawn under MOLECULE_SMOKE_MODE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The boot-smoke gate (molecule-core#2275) invokes adapters with stub creds and no network so it can exercise executor.execute() lazy imports. OpenClaw's setup() spawns a real `openclaw gateway --dev` subprocess that needs valid creds + network — under smoke env it exits immediately, raising RuntimeError("OpenClaw gateway process exited") and failing the publish-image workflow. Add a 1-line opt-out at the top of setup() so the runtime can reach its smoke short-circuit. Real production boots are unaffected. Closes the openclaw failure surfaced when running publish-image across all 8 workspace templates with the new boot-smoke step. Co-Authored-By: Claude Opus 4.7 (1M context) --- adapter.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/adapter.py b/adapter.py index bd3ba00..a6d144c 100644 --- a/adapter.py +++ b/adapter.py @@ -56,6 +56,16 @@ class OpenClawAdapter(BaseAdapter): async def setup(self, config: AdapterConfig) -> None: # pragma: no cover """Install OpenClaw, run onboard, copy workspace files, start gateway.""" + # Boot-smoke contract (molecule-core#2275): the publish-image gate + # invokes us with stub creds + no network so it can exercise lazy + # imports inside execute(). Real gateway spawn would fail here + # (no valid api_key, no `openclaw` binary on PATH yet), so skip + # the heavy setup path entirely. The runtime's smoke_mode short- + # circuit fires immediately after create_executor() returns. + if os.environ.get("MOLECULE_SMOKE_MODE") == "1": + logger.info("MOLECULE_SMOKE_MODE=1 — skipping OpenClaw gateway spawn") + return + npm_prefix = os.path.expanduser("~/.local") os.environ["PATH"] = f"{npm_prefix}/bin:{os.environ.get('PATH', '')}"