From bed7966f9d6eaa05c0323eefff21ad12d775958d Mon Sep 17 00:00:00 2001 From: Molecule AI Infra-Runtime-BE Date: Mon, 11 May 2026 07:40:08 +0000 Subject: [PATCH] fix(builtin_tools/temporal_workflow): collapse dead if/else in _platform_url() 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 --- workspace/builtin_tools/temporal_workflow.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/workspace/builtin_tools/temporal_workflow.py b/workspace/builtin_tools/temporal_workflow.py index b03ae781..9e934ca1 100644 --- a/workspace/builtin_tools/temporal_workflow.py +++ b/workspace/builtin_tools/temporal_workflow.py @@ -56,17 +56,15 @@ logger = logging.getLogger(__name__) def _platform_url() -> str: - """Return the platform URL, defaulting to host.docker.internal when running - inside a Docker container (where localhost refers to the container, not the - host). External callers can always override via the PLATFORM_URL env var. + """Return the platform URL, defaulting to host.docker.internal. - Note: both branches now 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. The if/else structure is - preserved for future extensibility. + The workspace runtime always runs inside a Docker container, so + ``localhost`` refers to the container itself, not the platform host. + The platform API is only reachable via ``host.docker.internal`` from + within a workspace container, regardless of how the container was started. + The legacy non-Docker branch is removed (it would have returned + ``localhost:8080`` which is unreachable from inside the container). """ - if os.path.exists("/.dockerenv") or os.environ.get("DOCKER_VERSION"): - return os.environ.get("PLATFORM_URL", "http://host.docker.internal:8080") return os.environ.get("PLATFORM_URL", "http://host.docker.internal:8080") # ─────────────────────────────────────────────────────────────────────────────