diff --git a/.github/workflows/publish-runtime.yml b/.github/workflows/publish-runtime.yml index c22fbcc7..b7c77f82 100644 --- a/.github/workflows/publish-runtime.yml +++ b/.github/workflows/publish-runtime.yml @@ -142,7 +142,14 @@ jobs: # of \`from molecule_runtime.transcript_auth import ...\` — the # 0.1.16 incident), this fails with ModuleNotFoundError instead # of shipping to PyPI and breaking every workspace startup. - import molecule_runtime.main # noqa: F401 + # Import the entry-point target by NAME — not just the module. + # The wheel's pyproject.toml declares + # `molecule-runtime = molecule_runtime.main:main_sync` so if + # main_sync goes missing (it did in 0.1.16-0.1.18), every + # workspace startup fails with `ImportError: cannot import name + # 'main_sync'`. Plain `import molecule_runtime.main` doesn't + # catch that because the module loads fine. + from molecule_runtime.main import main_sync # noqa: F401 from molecule_runtime import a2a_client, a2a_tools from molecule_runtime.builtin_tools import memory from molecule_runtime.adapters import get_adapter, BaseAdapter, AdapterConfig diff --git a/workspace/main.py b/workspace/main.py index 2dd9d4e4..a947123c 100644 --- a/workspace/main.py +++ b/workspace/main.py @@ -613,5 +613,18 @@ async def main(): # pragma: no cover await temporal_wrapper.stop() -if __name__ == "__main__": # pragma: no cover +def main_sync(): # pragma: no cover + """Synchronous entry point for the `molecule-runtime` console script. + + Declared in scripts/build_runtime_package.py as the wheel's entry-point + target (`molecule-runtime = "molecule_runtime.main:main_sync"`). Removed + silently during the pre-monorepo consolidation, which broke every + workspace startup against 0.1.16/0.1.17/0.1.18 with `ImportError: + cannot import name 'main_sync'`. The .github/workflows/runtime-pin-compat.yml + smoke step is the regression gate. + """ asyncio.run(main()) + + +if __name__ == "__main__": # pragma: no cover + main_sync()