From a9df950801c27b9cfbfec4970b971923b12f0ed4 Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Thu, 30 Apr 2026 21:54:02 -0700 Subject: [PATCH] fix(publish-template-image): inject PYTHONPATH=/app to match production provisioner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Second hot-fix for #2275 Phase 2 — boot smoke kept failing with `ModuleNotFoundError: No module named 'adapter'` even after the permissions fix landed. Root cause: the production platform's provisioner sets PYTHONPATH=/app on every workspace container (provisioner.go:563) so molecule-runtime — a pip console_scripts entry point whose sys.path[0] is /usr/local/bin, NOT /app — can resolve `importlib.import_module('adapter')`. The existing static import smoke didn't hit this because `python3 -c "import $mod"` adds cwd to sys.path; only the entry-point invocation needs PYTHONPATH. Mirrors prod by passing `-e PYTHONPATH=/app` in the docker run. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/publish-template-image.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/publish-template-image.yml b/.github/workflows/publish-template-image.yml index 0a6061f..4f3bd1f 100644 --- a/.github/workflows/publish-template-image.yml +++ b/.github/workflows/publish-template-image.yml @@ -308,10 +308,21 @@ jobs: # time but the smoke times out before any real call goes out. # Set the common ones so any adapter that early-validates a # specific key sees a non-empty value. + # PYTHONPATH=/app mirrors what the platform's provisioner + # injects at workspace startup (workspace-server/internal/ + # provisioner/provisioner.go:563). Without it, + # `importlib.import_module('adapter')` in the runtime's + # preflight check fails with ModuleNotFoundError because + # molecule-runtime is a console_scripts entry point — + # sys.path[0] is /usr/local/bin, NOT /app. The existing + # static import smoke step above doesn't hit this because + # `python3 -c "import $mod"` adds cwd to sys.path; only the + # entry-point invocation needs PYTHONPATH. set +e timeout 60 docker run --rm \ -v "${SMOKE_CONFIG_DIR}:/configs" \ -e WORKSPACE_ID=fake-smoke \ + -e PYTHONPATH=/app \ -e MOLECULE_SMOKE_MODE=1 \ -e MOLECULE_SMOKE_TIMEOUT_SECS=10 \ -e CLAUDE_CODE_OAUTH_TOKEN=sk-fake-smoke-token \