fix: restore main_sync entry point in workspace/main.py
The wheel's pyproject.toml has declared `molecule-runtime = "molecule_runtime.main:main_sync"` since the publish pipeline was created on 2026-04-26, but the function itself was never present in workspace/main.py — it lived in the pre-monorepo molecule-ai-workspace-runtime repo and was lost during the consolidation that made workspace/ the source of truth. The 0.1.15 wheel still had main_sync from a leftover snapshot, so the regression went unnoticed until 0.1.16 (the first wheel built from the new source-of-truth) shipped. Symptom: every workspace container restart loops with ImportError: cannot import name 'main_sync' from 'molecule_runtime.main' — the molecule-runtime CLI script's first line tries to import the missing symbol. Workspaces stay in `provisioning` until the 10-min sweep marks them failed. Caught by .github/workflows/runtime-pin-compat.yml, which already imports the symbol by name as its smoke test. (That check kept failing red on every recent merge_group run; this PR fixes the underlying symbol-not-found instead of the smoke step.) Also strengthens publish-runtime.yml's wheel smoke from `import molecule_runtime.main` (loads the module — passes even when entry-point target is missing) to `from molecule_runtime.main import main_sync` (the actual contract the CLI script needs). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5022a740e1
commit
3df5867b56
9
.github/workflows/publish-runtime.yml
vendored
9
.github/workflows/publish-runtime.yml
vendored
@ -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
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user