The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(pm): exclude Android from generated workspace solves
Warren91c86af05518
diff --git a/pm/workspace.py b/pm/workspace.pyindex 74b4ef881a4..ac31449ba22 100644--- a/pm/workspace.py+++ b/pm/workspace.py@@ -10,6 +10,7 @@ import hashlibimport jsonimport osimport shutil+import sysfrom collections.abc import Mappingfrom pathlib import Pathfrom typing import TYPE_CHECKING, Optional@@ -159,6 +160,9 @@ def _generate_pyproject(plugin_dirs: list[Path] | Mapping[Path, Path], root: Patuv_policy.pop("exclude-newer", None)uv_policy.pop("exclude-newer-package", None)uv_policy["workspace"] = {"members": sorted(members)}+ # Termux is a real install target: only rewrite the solve off-Android.+ if sys.platform != "android":+ _exclude_android_from_solve(uv_policy)text = tomli_w.dumps(document)else:# A member-less generation syncs frozen against core's own lock.@@ -182,6 +186,24 @@ def _without_release_age(text: str) -> str:return re.sub(r"(?m)^exclude-newer\s*=.*\n", "", text)+def _exclude_android_from_solve(uv_policy: dict) -> None:+ """Drop Android from ``tool.uv.environments`` in a generated workspace.++ uv solves every platform its environment markers can name, Android included;+ a plugin's native transitives (torch behind an optional extra) can have no+ Python 3.14 wheels there, and one unsolvable platform fails the whole lock —+ the update then evicts the plugin. A generated workspace installs on one+ host, so its solve only has to cover that host's platform set. The core's+ own lock never passes through here and keeps its full platform coverage.+ """+ environments = uv_policy.get("environments")+ uv_policy["environments"] = (+ [f"{entry} and sys_platform != 'android'" for entry in environments]+ if environments+ else ["sys_platform != 'android'"]+ )++def _is_member_candidate(plugin_dir: Path) -> bool:return read_python_declaration(plugin_dir).installs_packagesdiff --git a/tests/pm/test_workspace_android_exclusion.py b/tests/pm/test_workspace_android_exclusion.pynew file mode 100644index 00000000000..689e73d0953--- /dev/null+++ b/tests/pm/test_workspace_android_exclusion.py@@ -0,0 +1,40 @@+"""Generated workspaces must not solve for Android.++Regression guard for the update-time plugin eviction (2026-10-23): uv's universal+resolution solves every platform named by ``tool.uv.environments``, Android+included, and a plugin-carried native transitive (torch behind the nerve plugin's+optional ``laya`` extra) has no Python 3.14 Android wheels — one unsolvable+platform fails the whole workspace lock, and ``hermes update`` then evicts the+plugin. The generated workspace installs on one host, so its solve is narrowed to+non-Android platforms on a non-Android host (``pm.workspace._generate_pyproject``).+"""++from pm.workspace import _exclude_android_from_solve+++def test_existing_environments_lose_android_only():+ uv_policy = {"environments": ["python_version >= '3.14'"]}+ _exclude_android_from_solve(uv_policy)+ assert uv_policy["environments"] == [+ "python_version >= '3.14' and sys_platform != 'android'"+ ]+++def test_multiple_environment_entries_all_narrowed():+ uv_policy = {"environments": ["python_version >= '3.14'", "python_version < '3.14'"]}+ _exclude_android_from_solve(uv_policy)+ assert all(entry.endswith(" and sys_platform != 'android'")+ for entry in uv_policy["environments"])+ assert len(uv_policy["environments"]) == 2+++def test_missing_environments_gets_platform_only_entry():+ uv_policy: dict = {}+ _exclude_android_from_solve(uv_policy)+ assert uv_policy["environments"] == ["sys_platform != 'android'"]+++def test_unrelated_uv_policy_keys_untouched():+ uv_policy = {"default-groups": [], "environments": ["python_version >= '3.14'"]}+ _exclude_android_from_solve(uv_policy)+ assert uv_policy["default-groups"] == []\ No newline at end of file