fix(runtime): honor per-workspace urls and a2a sdk enum shape #27

Merged
hongming merged 2 commits from fix/multi-workspace-platform-url-runtime into main 2026-05-21 06:36:13 +00:00
Owner

Root cause

Two runtime SSOT issues were confirmed:

  1. MOLECULE_WORKSPACES[].platform_url was parsed and registered in platform_auth, but mcp_cli.main() still used the module-level PLATFORM_URL for startup POST /registry/register, heartbeat threads, and inbox pollers. A local bridge spanning multiple tenant URLs would therefore register and poll every workspace against the first/default tenant.

  2. origin/main already failed the full local test suite against the installed a2a-sdk shape. The SDK exposes TaskState as a protobuf EnumTypeWrapper; source and tests were using TaskState.TASK_STATE_* attributes directly. Google ADK tests also asserted legacy raw-string enqueue events even though A2A v1 helpers return protobuf Message objects.

Fix

  • Compute one effective platform URL per workspace in the runtime SSOT.
  • Use that URL for platform_register() and start_heartbeat_thread().
  • Pass the workspace URL map into inbox poller startup while preserving one shared inbox singleton.
  • Keep start_inbox_pollers(platform_url, workspace_ids) backward-compatible with an optional third argument.
  • Add shared task_state_value() helper so runtime code works with protobuf TaskState.Value(...) and test stubs.
  • Move Google ADK responses to the shared new_response_message() helper and avoid echoing adapter exception details into chat-visible A2A messages.
  • Update tests to assert A2A v1 Message payload text instead of raw strings.

Verification

  • RED: python3 -m pytest tests/test_per_workspace_platform_url.py -q failed on the new register/heartbeat and inbox URL-map assertions before the implementation.
  • RED: clean origin/main reproduced the 15 Google ADK / A2A cancel failures before the SDK-drift fix.
  • GREEN: python3 -m pytest molecule_runtime/adapters/google-adk/test_adapter.py tests/test_a2a_nonblocking_inbox.py -q → 58 passed.
  • GREEN: python3 -m pytest tests/test_per_workspace_platform_url.py tests/test_mcp_cli_multi_workspace.py tests/test_a2a_multi_workspace.py -q → 60 passed.
  • GREEN: python3 -m py_compile molecule_runtime/adapters/google-adk/adapter.py molecule_runtime/a2a_executor.py molecule_runtime/executor_helpers.py.
  • GREEN: python3 -m pytest -q → 310 passed.
## Root cause Two runtime SSOT issues were confirmed: 1. `MOLECULE_WORKSPACES[].platform_url` was parsed and registered in `platform_auth`, but `mcp_cli.main()` still used the module-level `PLATFORM_URL` for startup `POST /registry/register`, heartbeat threads, and inbox pollers. A local bridge spanning multiple tenant URLs would therefore register and poll every workspace against the first/default tenant. 2. `origin/main` already failed the full local test suite against the installed `a2a-sdk` shape. The SDK exposes `TaskState` as a protobuf `EnumTypeWrapper`; source and tests were using `TaskState.TASK_STATE_*` attributes directly. Google ADK tests also asserted legacy raw-string enqueue events even though A2A v1 helpers return protobuf `Message` objects. ## Fix - Compute one effective platform URL per workspace in the runtime SSOT. - Use that URL for `platform_register()` and `start_heartbeat_thread()`. - Pass the workspace URL map into inbox poller startup while preserving one shared inbox singleton. - Keep `start_inbox_pollers(platform_url, workspace_ids)` backward-compatible with an optional third argument. - Add shared `task_state_value()` helper so runtime code works with protobuf `TaskState.Value(...)` and test stubs. - Move Google ADK responses to the shared `new_response_message()` helper and avoid echoing adapter exception details into chat-visible A2A messages. - Update tests to assert A2A v1 Message payload text instead of raw strings. ## Verification - RED: `python3 -m pytest tests/test_per_workspace_platform_url.py -q` failed on the new register/heartbeat and inbox URL-map assertions before the implementation. - RED: clean `origin/main` reproduced the 15 Google ADK / A2A cancel failures before the SDK-drift fix. - GREEN: `python3 -m pytest molecule_runtime/adapters/google-adk/test_adapter.py tests/test_a2a_nonblocking_inbox.py -q` → 58 passed. - GREEN: `python3 -m pytest tests/test_per_workspace_platform_url.py tests/test_mcp_cli_multi_workspace.py tests/test_a2a_multi_workspace.py -q` → 60 passed. - GREEN: `python3 -m py_compile molecule_runtime/adapters/google-adk/adapter.py molecule_runtime/a2a_executor.py molecule_runtime/executor_helpers.py`. - GREEN: `python3 -m pytest -q` → 310 passed.
hongming added 1 commit 2026-05-21 05:39:32 +00:00
fix(mcp): honor per-workspace platform urls
ci / unit-tests (pull_request) Successful in 1m26s
ci / lint (pull_request) Successful in 47s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 3s
ci / build (pull_request) Successful in 1m19s
ci / smoke-install (pull_request) Successful in 2m2s
a6701b728c
app-fe added 1 commit 2026-05-21 05:51:14 +00:00
fix(a2a): handle protobuf task state enum
ci / lint (pull_request) Successful in 1m0s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 18s
ci / unit-tests (pull_request) Successful in 1m59s
ci / build (pull_request) Successful in 1m44s
ci / smoke-install (pull_request) Successful in 1m41s
b9540250b6
hongming changed title from fix(mcp): honor per-workspace platform_url for startup loops to fix(runtime): honor per-workspace urls and a2a sdk enum shape 2026-05-21 05:51:29 +00:00
sdk-lead approved these changes 2026-05-21 06:35:47 +00:00
sdk-lead left a comment
Member

Approved as sdk-lead: CI green, full local suite passed (310 tests), and change is scoped to runtime SSOT fixes for multi-workspace platform_url routing plus A2A SDK enum compatibility.

Approved as sdk-lead: CI green, full local suite passed (310 tests), and change is scoped to runtime SSOT fixes for multi-workspace platform_url routing plus A2A SDK enum compatibility.
infra-runtime-be approved these changes 2026-05-21 06:36:06 +00:00
infra-runtime-be left a comment
Member

Approved as infra-runtime-be: reviewed runtime SSOT scope and green gates; safe to merge.

Approved as infra-runtime-be: reviewed runtime SSOT scope and green gates; safe to merge.
hongming merged commit 9b74607099 into main 2026-05-21 06:36:13 +00:00
Sign in to join this conversation.
4 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-ai-workspace-runtime#27