The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(platforms): raise, don't assert, when an ensured node/npm has no binary
ethernetb1c1aa9a28b4
diff --git a/plugins/platforms/photon/adapter.py b/plugins/platforms/photon/adapter.pyindex ee8962fc451..38a2a9515ea 100644--- a/plugins/platforms/photon/adapter.py+++ b/plugins/platforms/photon/adapter.py@@ -284,7 +284,8 @@ def _reinstall_sidecar_deps() -> None:if npm is None:env = pm.ensure("npm").envinstalled = pm.installed_package("npm")- assert installed is not None and installed.binary is not None+ if installed is None or installed.binary is None:+ raise pm.InstallError("npm", "ensured but no selected binary was recorded")npm = str(installed.binary)except pm.InstallError as exc:logger.warning("[photon] cannot prepare sidecar dependencies: %s", exc)@@ -963,7 +964,8 @@ class PhotonAdapter(BasePlatformAdapter):try:await asyncio.to_thread(pm.ensure, "node")installed = pm.installed_package("node")- assert installed is not None and installed.binary is not None+ if installed is None or installed.binary is None:+ raise pm.InstallError("node", "ensured but no selected binary was recorded")self._node_bin = str(installed.binary)except pm.InstallError as exc:raise PhotonSidecarStartupError(str(exc), code="SIDECAR_NODE_MISSING", retryable=False) from excdiff --git a/plugins/platforms/photon/cli.py b/plugins/platforms/photon/cli.pyindex d2f892c0553..847fd328d5f 100644--- a/plugins/platforms/photon/cli.py+++ b/plugins/platforms/photon/cli.py@@ -299,7 +299,8 @@ def _install_sidecar() -> int:if npm is None:env = pm.ensure("npm", explicit=True).envinstalled = pm.installed_package("npm")- assert installed is not None and installed.binary is not None+ if installed is None or installed.binary is None:+ raise pm.InstallError("npm", "ensured but no selected binary was recorded")npm = str(installed.binary)except pm.InstallError as exc:print(f"Could not prepare Photon dependencies: {exc}", file=sys.stderr)diff --git a/plugins/platforms/whatsapp/adapter.py b/plugins/platforms/whatsapp/adapter.pyindex 27195956b81..dc192ae46b5 100644--- a/plugins/platforms/whatsapp/adapter.py+++ b/plugins/platforms/whatsapp/adapter.py@@ -350,7 +350,8 @@ class WhatsAppAdapter(WhatsAppBehaviorMixin, BasePlatformAdapter):if _npm_bin is None:env = pm.ensure("npm").envinstalled = pm.installed_package("npm")- assert installed is not None and installed.binary is not None+ if installed is None or installed.binary is None:+ raise pm.InstallError("npm", "ensured but no selected binary was recorded")_npm_bin = str(installed.binary)install_result = subprocess.run([_npm_bin, "install", "--silent"], cwd=str(bridge_dir), timeout=env_int("WHATSAPP_NPM_INSTALL_TIMEOUT", 300),env=env, **_RUN_TEXT)