fix(wheel): import inbox without alias to dodge rewriter collision - #2436
Merged
HongmingWang-Rabbit merged 1 commit intoMay 1, 2026
Merged
Conversation
PR #2433 (notifications/claude/channel) shipped 'import inbox as _inbox_module' inside a2a_mcp_server.py:main(). The build script's import rewriter expands plain 'import inbox' to 'import molecule_runtime.inbox as inbox', so the original source became 'import molecule_runtime.inbox as inbox as _inbox_module', which is invalid Python. Caught at the publish-runtime + PR-built-wheel-smoke gate (the SyntaxError trace is in run 25200422679). The wheel didn't ship to PyPI because publish-runtime's smoke-import step refused to install it, but staging is currently sitting on a broken-build commit until this fix-forward lands. Changes: - a2a_mcp_server.py: lift `import inbox` to top of file (rewriter produces clean `import molecule_runtime.inbox as inbox`), call inbox.set_notification_callback directly in main() - build_runtime_package.py: rewrite_imports() now raises ValueError when it sees 'import X as Y' for any X in the workspace allowlist, instead of silently producing a syntax-error wheel. Operator gets a clear actionable error at build time pointing at the offending line + suggested rewrites ('from X import …' or plain 'import X'). The build-time gate (this PR's rewriter check) catches the regression class earlier than the smoke-time gate (PR #2433's failure). Adding 'PR-built wheel + import smoke' to staging branch protection's required checks is filed separately so this class doesn't merge again. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
HongmingWang-Rabbit
requested a review
from hongmingwang-moleculeai
as a code owner
May 1, 2026 03:22
HongmingWang-Rabbit
enabled auto-merge
May 1, 2026 03:22
This was referenced May 1, 2026
HongmingWang-Rabbit
pushed a commit
that referenced
this pull request
Jun 12, 2026
… line, full text on hover' (#2436) from fix/concierge-role-truncate into main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix-forward for the broken wheel build PR #2433 shipped to staging.
PR #2433 added
import inbox as _inbox_moduleinsidea2a_mcp_server.py:main(). The build script's import rewriter expands plainimport inboxtoimport molecule_runtime.inbox as inbox— so the original source becameimport molecule_runtime.inbox as inbox as _inbox_module, which is invalid Python.The wheel didn't reach PyPI (publish-runtime's smoke-import step refused to install it — see run 25200422679), but staging is currently sitting on a broken-build commit until this lands.
Changes
a2a_mcp_server.py— liftimport inboxto the top of the file (rewriter produces cleanimport molecule_runtime.inbox as inbox), callinbox.set_notification_callback(...)directly inmain(). No behavior change in the source repo; the wheel goes from broken to working.build_runtime_package.py—rewrite_imports()now raisesValueErrorwhen it seesimport X as Yfor any X in the workspace allowlist, instead of silently producing a syntax-error wheel. Operators get a clear actionable error at build time pointing at the offending line + suggested rewrites (from X import …or plainimport X).The build-time gate (this PR's rewriter check) catches the regression class earlier than the smoke-time gate (PR #2433's failure mode). Adding 'PR-built wheel + import smoke' to staging branch protection's required checks is filed separately so this class can't merge again.
Test plan
import inbox→ valid;import inbox as _foo→ ValueError with actionable messageWhy two fixes in one PR
The
a2a_mcp_server.pyedit alone unbreaks the wheel. Thebuild_runtime_package.pyhardening prevents the regression from recurring without an obvious build-time signal. Splitting the PR would mean either (a) shipping the fix without the gate, or (b) shipping the gate after the fix already proved the gap. Both fix the same incident — keeping them together makes the rationale legible.🤖 Generated with Claude Code