fix(workspace): push-mode Queued returns delivery_mode="push" (not silent default "poll") #335

Closed
infra-runtime-be wants to merge 6 commits from runtime/fix-a2a-push-delivery-mode into main

6 Commits

Author SHA1 Message Date
bed7966f9d fix(builtin_tools/temporal_workflow): collapse dead if/else in _platform_url()
All checks were successful
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 27s
audit-force-merge / audit (pull_request) Has been skipped
sop-tier-check / tier-check (pull_request) Successful in 10s
RC 835 (infra-lead): the if/else that checked for Docker and set the
PLATFORM_URL default had both branches return the same value. Collapsed
to a single return statement with a docstring explaining why the legacy
non-Docker branch is removed.

This completes Path B: all 6 PLATFORM_URL sites in this PR now have
clean, non-dead default logic.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 07:40:08 +00:00
151b6021fb fix(workspace): resolve dead if/else branches in PLATFORM_URL defaults + update PR description
All checks were successful
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 23s
sop-tier-check / tier-check (pull_request) Successful in 28s
RC 835 (infra-lead): the if/else that checks for Docker and sets PLATFORM_URL
default had both branches return the same value (host.docker.internal), making
the conditional dead code. Fixed by:
- Simplifying to a single PLATFORM_URL assignment with a comment explaining
  why both Docker and non-Docker paths use the same default (the platform API
  is only reachable via host.docker.internal from within a workspace container,
  regardless of how the container was started)
- Preserving the if/else structure in temporal_workflow.py._platform_url()
  with an updated docstring note, for future extensibility

Also: updated PR description to accurately reflect all three changes bundled
in this PR (Queued delivery_mode fix + PLATFORM_URL alignment + KI-296
plugins_registry shim).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 07:35:46 +00:00
f7da399595 test(workspace): add queue_id-absence and push-vs-poll distinction tests
Some checks failed
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 3s
sop-tier-check / tier-check (pull_request) Failing after 30s
Incorporates valuable extra coverage from fullstack-engineer's PR #336:
- test_push_queued_missing_queue_id_still_parsed: queue_id is optional,
  absence must not break parsing
- test_push_queued_is_distinct_from_poll_queued: both envelope shapes
  parse correctly and independently, with correct delivery_mode values

Also adds push_queued_no_queue_id fixture and regression gate entry.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 02:24:29 +00:00
6be36906f4 fix(workspace): push-mode Queued returns delivery_mode="push" (not silent default "poll")
Bug: a2a_response.py:197 returned Queued(method=method) without passing
delivery_mode, silently defaulting to "poll" for push-mode busy-queue
responses. Callers branching on v.delivery_mode would mis-identify push-mode
responses as poll-mode, causing wrong dispatch logic.

Fix: pass delivery_mode="push" explicitly in the push-mode branch.

Tests: add push_queued_full/notify/no_method fixtures and 4 test cases
asserting delivery_mode="push" for all three envelope shapes. Also add
adversarial {"queued": "yes"} and {"queued": False} → Malformed guards.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 02:24:29 +00:00
c814aa2210 fix(workspace): register plugins_registry as sys.modules shim before loading adapters
KI-296 fix: when the PyPI-installed runtime (molecule-ai-workspace-runtime
0.1.129+) ships plugins_registry as molecule_runtime.plugins_registry (a
subpackage), plugin adapter files that do ``from plugins_registry import ...``
as a top-level name fail with ModuleNotFoundError because Python's import
system cannot find a top-level ``plugins_registry`` package.

The fix in plugins_registry/__init__.py:_load_module_from_path() registers
molecule_runtime.plugins_registry as ``plugins_registry`` in sys.modules
before exec'ing any plugin adapter file, so the top-level import resolves
correctly in both environments:
- PyPI wheel (molecule_runtime.plugins_registry → sys.modules["plugins_registry"])
- molecule-core workspace source (top-level workspace/plugins_registry already
  on sys.path; the setdefault is a no-op)

Submodules (builtins, protocol, raw_drop) are also registered so adapters
that import ``from plugins_registry.builtins import ...`` work without error.

Added test_load_module_from_path_registers_plugins_registry_sys_modules.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 02:24:29 +00:00
716ec95b7d fix(workspace): default PLATFORM_URL to host.docker.internal in all modules
KI-014 follow-on: inside a workspace container, localhost refers to the
container itself, not the platform. Four files had the Docker-aware
if-branch correct but fell through to localhost:8080 as the non-Docker
fallback — effectively making the Docker path the ONLY path that works,
since local dev on Mac/Linux can also resolve host.docker.internal via
the Docker daemon's built-in resolver.

Fix: unify the default to host.docker.internal in both branches, so
the env-var override always works and no caller ever silently falls
back to the wrong address.

- a2a_cli.py: else branch hardcoded localhost → host.docker.internal
- consolidation.py: same
- coordinator.py: same
- builtin_tools/temporal_workflow.py: two inline os.environ.get defaults
  replaced with a _platform_url() helper for DRY + consistent detection

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 02:24:29 +00:00