The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(pm): release age is checked when Hermes locks, not on users' machines
Tekniumabbc2ba35c8b
diff --git a/pm/AGENTS.md b/pm/AGENTS.mdindex 34f095f7eb6..ce6b3503003 100644--- a/pm/AGENTS.md+++ b/pm/AGENTS.md@@ -18,11 +18,11 @@ Use `pm.build_environment` for fresh build outputs and `pm.ensure_environment` fisolated tool environments. Callers receive an interpreter or tool path, not uv.Nix's declarative uv2nix builds and unrelated user projects remain independently owned.-The `[tool.uv] exclude-newer = "14 days"` quarantine covers **Hermes's own dependencies only**-(every registry package in core's `uv.lock`). Plugin `python_dependencies` follow the plugin's own-policy: when PM generates the plugin workspace (`pm/workspace.py::_core_release_quarantine`) the-global cutoff moves onto each core-locked package, so plugin-only packages are not filtered and a-plugin still cannot drag a core package past the window. Teknium's ruling: "plugins dont have to-abide by our 14 day rule … Only hermes' dependencies themselves have to." We recommend (not require)-plugin authors adopt their own quarantine — the developer guide and `plugin-catalog/README.md` carry-that guidance.+The `[tool.uv] exclude-newer = "3 days"` release-age check covers **Hermes's own dependencies+only**, exact pins included, with no per-package exemptions, and it runs when Hermes LOCKS+(`hermes pm lock`, CI's lock check), never on users' machines. When PM generates the plugin workspace+(`pm/workspace.py::_trust_core_lock`) it drops the cutoff and constrains every core-locked package to+its locked version: users trust the vetted lock, so a mirror without upload times cannot break an+install (#135589), and a plugin cannot move a core package. Plugin `python_dependencies` follow the+plugin's own policy. Teknium's rulings: "plugins dont have to abide by our 14 day rule … Only hermes'+dependencies themselves have to"; dates are checked by us, not users; pinned deps need >3 days.diff --git a/pm/environment.py b/pm/environment.pyindex e60b0d9a6a7..83c7d42461a 100644--- a/pm/environment.py+++ b/pm/environment.py@@ -56,9 +56,9 @@ _BUILD_MARKERS = ("the build backend returned an error",)# and hints the version was filtered, so that case needs both lines._UNDATED_PIN = "has no publish time"_UNDATED_FILE = ("is missing an upload date", "was filtered by `exclude-newer")-UNDATED_INDEX_HINT = ("the package index did not report upload times, which Hermes needs to apply its "- "14-day release-age check. Use https://pypi.org/simple or a mirror that serves "- "upload times (pip.conf index-url / UV_INDEX_URL), then retry.")+UNDATED_INDEX_HINT = ("the package index did not report upload times, which locking Hermes's "+ "dependencies needs for its 3-day release-age check. Use https://pypi.org/simple "+ "or a mirror that serves upload times (pip.conf index-url / UV_INDEX_URL), then retry.")class ResolutionConflict(InstallError):diff --git a/pm/workspace.py b/pm/workspace.pyindex a15e2c93ca0..b893c19583c 100644--- a/pm/workspace.py+++ b/pm/workspace.py@@ -129,7 +129,7 @@ def _generate_pyproject(plugin_dirs: list[Path] | Mapping[Path, Path], root: Patimport tomli_wdocument = tomllib.loads(core_text)- _core_release_quarantine(document, source / "uv.lock")+ _trust_core_lock(document, source / "uv.lock")document.setdefault("tool", {}).setdefault("uv", {})["workspace"] = {"members": sorted(members)}text = tomli_w.dumps(document)else:@@ -140,32 +140,32 @@ def _generate_pyproject(plugin_dirs: list[Path] | Mapping[Path, Path], root: Pattarget.write_text(text, encoding="utf-8")-def _core_release_quarantine(document: dict, core_lock: Path) -> None:- """Scope core's ``exclude-newer`` to the packages in core's own lock.+def _trust_core_lock(document: dict, core_lock: Path) -> None:+ """Hold core's packages at the versions core's lock already vetted.- The quarantine covers Hermes's own dependencies only; a plugin's dependencies- follow the plugin's own policy, so a catalog pin floored on a fresh release still- installs. A global cutoff would filter plugin-only packages too, so it moves onto- every registry package core locks. A plugin still cannot drag one of those past- the window, and core's own ``= false`` exemptions stay as written.+ Release age is checked when Hermes locks (``exclude-newer`` in pyproject.toml, which+ CI's lock check enforces), not on the user's machine: many package mirrors publish no+ upload times, and uv rejects a file it cannot date ("X==V has no publish time",+ #135589). So the generated root drops the cutoff and constrains every core-locked+ registry package to its locked version instead; a plugin cannot drag one to an+ unvetted release, and plugin-only packages follow the plugin's own policy. A package+ the lock forks by platform (psutil: PyPI everywhere, git on Android) is left to the+ resolver, which the seed lock already steers."""- import reimport tomllib-- settings = document.get("tool", {}).get("uv", {})- cutoff = settings.pop("exclude-newer", None)- if cutoff is None:- return-- def normalized(name: str) -> str:- return re.sub(r"[-_.]+", "-", name).lower()-- per_package = {normalized(name): value- for name, value in settings.get("exclude-newer-package", {}).items()}+ from collections import defaultdict++ settings = document.setdefault("tool", {}).setdefault("uv", {})+ settings.pop("exclude-newer", None)+ settings.pop("exclude-newer-package", None)+ if not core_lock.is_file():+ return # nothing vetted to hold; the resolver keeps core's declared ranges+ entries = defaultdict(list)for package in tomllib.loads(core_lock.read_text(encoding="utf-8-sig")).get("package", []):- if "registry" in package.get("source", {}):- per_package.setdefault(normalized(package["name"]), cutoff)- settings["exclude-newer-package"] = per_package+ entries[package["name"]].append(package)+ pins = [f"{name}=={rows[0]['version']}" for name, rows in sorted(entries.items())+ if len(rows) == 1 and "registry" in rows[0].get("source", {})]+ settings["constraint-dependencies"] = [*settings.get("constraint-dependencies", []), *pins]def _is_member_candidate(plugin_dir: Path) -> bool:diff --git a/pyproject.toml b/pyproject.tomlindex 852acc06b92..a79d7ddfc47 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -624,160 +624,13 @@ override-dependencies = [# Remove this line when misaki drops it or a 3.14-capable release fits."spacy-curated-transformers; sys_platform == 'never'",]-exclude-newer = "14 days"-# h2: temporary exclude-newer exception for the CVE-2026-71554 (GHSA-6hr6-w5qg-qmwg,-# request-smuggling) fix in 4.4.1, published 2026-08-03. Remove after 2026-08-17.-# aiohttp, cryptography: same shape — the advisory fixes are newer than the-# 14-day window, so the resolver cannot see them without an exception.-#-# defusedxml, python-olm, unpaddedbase64: the OPPOSITE shape (#80387, #79434,-# #78227 family). These are ancient, effectively frozen releases (2021-2023)-# whose upload dates are frequently absent from mirror indexes and stale uv-# HTTP caches. uv treats a missing upload date as "newer than the cutoff" and-# excludes the package, bricking [youtube]/[wecom]/[matrix] resolution-# ("there are no versions of defusedxml"). Exempting them carries zero aging-# risk — their newest releases are years old — and unbricks resolvers that-# cannot see upload dates.-#-# setuptools, wheel, pillow, mcp: build/core pin bricks (#78227, #75992, #76020, #96488). uv-# applies exclude-newer to build-system.requires and core deps too; when a-# resolver cannot see an upload date (old uv, mirror index, stale HTTP cache)-# it filters the pinned version and the package cannot even BUILD-# ("No solution found when resolving: setuptools==83.0.0"). These deps are-# exact-pinned (==X.Y.Z), so exclude-newer adds zero float protection for-# them — the version cannot move without a reviewed pin bump — while the-# cutoff can still brick installs. Exempting exact pins is pure brick-risk-# removal at no supply-chain cost. Guarded by-# tests/test_packaging_metadata.py::test_build_system_requires_exempt_from_exclude_newer.-#-# firecrawl-anydoc: same exact-pin shape (==0.2.4, hosted-OCR wiring PR).-# The pin bump WAS the review; exclude-newer adds zero float protection to-# an exact pin and would only delay the reviewed version 14 days.-#-# Every other exact-pinned package below: the release-day brick shape-# (observed 2026-08-29 updating three long-running installs v0.20.0 ->-# v0.20.6 — one Termux, two Linux servers). Each release exact-pins at least-# one dependency to a version published days before the release (v0.20.6-# pinned snowballstemmer==3.1.1 and psutil==7.2.2 in core, plus fastapi /-# uvicorn / python-telegram-bot pins across extras). For two weeks after-# release the cutoff filters those versions out, so any venv that predates-# the release bricks on `hermes update` ("no version of-# snowballstemmer==3.1.1") until the window passes. Same zero-float--# protection logic as setuptools/pillow/mcp above; enforced for every exact-# pin by-# tests/test_packaging_metadata.py::test_exact_pinned_deps_exempt_from_exclude_newer.-#-# maturin, setuptools-rust: build-system.requires of the cryptography pin-# above. cryptography itself is exempted, but on wheel-less platforms-# (Termux/Android) it must build from sdist, and the isolated build-# environment resolves under the same cutoff ("Failed to resolve-# requirements from build-system.requires ... maturin>=1.9,<2").-#-# google-cloud-pubsub: same exact-pin shape (==2.39.2, google-chat adapter).-# The pin bump WAS the review; exclude-newer only filters it because the-# 14-day window is younger than the reviewed release.--[tool.uv.exclude-newer-package]-agent-client-protocol = false-aiohttp = false-aiohttp-socks = false-aiosqlite = false-alibabacloud-dingtalk = false-anthropic = false-asyncpg = false-azure-identity = false-boto3 = false-brotlicffi = false-browser-harness = false-certifi = false-concurrent-log-handler = false-croniter = false-cryptography = false-daytona = false-ddgs = "2026-08-26T21:52:34Z"-debugpy = false-defusedxml = false-dingtalk-stream = false-discord-py = false-edge-tts = false-elevenlabs = false-exa-py = false-fal-client = false-fastapi = false-faster-whisper = false-fire = false-firecrawl-anydoc = false-firecrawl-py = false-google-api-python-client = false-google-auth = false-google-auth-httplib2 = false-google-auth-oauthlib = false-google-cloud-pubsub = false-h2 = false-httplib2 = false-httpx = false-httpx2 = false-huggingface_hub = false-jinja2 = false-langfuse = "2026-09-09T16:01:26Z"-lark-oapi = false-markdown = false-maturin = false-mautrix = false-mcp = false-microsoft-teams-apps = false-mistralai = false-modal = false-nemo-relay = false-neutts = "2026-07-22T14:54:23Z"-numpy = false-openai = false-opentelemetry-exporter-otlp-proto-http = false-opentelemetry-sdk = false-packaging = false-parallel-web = false-pathspec = false-pillow = false-piper-tts = "2026-09-04T16:47:32Z"-prompt-toolkit = false-psutil = false-pvporcupine = false-pyasn1 = false-pydantic = false-pyjwt = false-pytest = false-pytest-asyncio = false-python-dotenv = false-python-multipart = false-python-olm = false-python-telegram-bot = false-pyyaml = false-qrcode = false-requests = false-rich = false-ruamel-yaml = false-ruff = false-sentencepiece = false-setuptools = false-setuptools-rust = false-wheel = false-sherpa-onnx = "2026-09-10T17:00:04Z"-# The core is exact-pinned by sherpa-onnx. Admit all wheels of that release.-sherpa-onnx-core = "2026-09-10T15:58:47Z"-slack-bolt = false-slack-sdk = false-snowballstemmer = false-sounddevice = false-soundfile = "2026-06-06T08:58:48Z"-starlette = false-tenacity = false-ty = false-tzdata = false-unpaddedbase64 = false-uvicorn = false-vercel = false-websockets = false-youtube-transcript-api = false+# Release-age check: Hermes's dependencies must be at least 3 days old when Hermes+# locks them. It runs where uv.lock is resolved (`hermes pm lock`, and CI's lock+# check), never on users' machines: PM installs from this vetted lock and drops the+# cutoff from what it generates (pm/workspace.py::_trust_core_lock), because many+# package mirrors publish no upload times and uv rejects a file it cannot date+# (#135589). Exact pins follow the same 3-day rule; there are no exemptions.+exclude-newer = "3 days"[tool.setuptools]# Root single-file modules are derived by setup.py at build time from thediff --git a/tests/pm/test_workspace.py b/tests/pm/test_workspace.pyindex 5d0aadd9dd2..0e4d0b17bd3 100644--- a/tests/pm/test_workspace.py+++ b/tests/pm/test_workspace.py@@ -60,37 +60,35 @@ def test_missing_explicit_seed_cannot_silently_resolve_new_versions(layout):assert not (tmp / "env").exists()-def test_core_quarantine_covers_core_packages_and_not_plugin_ones(layout, locked_project):- """Regression for #120076: Hermes's 14-day cutoff must not filter a plugin's own deps.+def test_plugin_workspace_trusts_core_lock_instead_of_rechecking_release_age(layout, locked_project): # health: allow F811 -- pytest injects the imported locked_project fixture by parameter name+ """Release age is checked when Hermes locks, never on the user's machine (#135589).- A global ``exclude-newer`` in the generated root made a catalog pin floored on a fresh- release unresolvable. The cutoff now travels per package: every registry package in- core's lock keeps it (or core's explicit exemption), plugin-only packages follow the- plugin's policy, and the rewritten root still locks and syncs.+ The generated root carries no ``exclude-newer`` (a mirror without upload times makes+ uv reject every file it cannot date) and instead holds each core-locked package at its+ locked version, so a plugin cannot move one; plugin-only packages stay free (#120076)."""import tomllibtmp, core, plug_a, _ = layout_, uv, env = locked_projectmanifest = core / "pyproject.toml"- manifest.write_text(manifest.read_text().replace("[tool.uv]\n", '[tool.uv]\nexclude-newer="14 days"\n', 1)+ manifest.write_text(manifest.read_text().replace("[tool.uv]\n", '[tool.uv]\nexclude-newer="3 days"\n', 1)+ '[tool.uv.exclude-newer-package]\nBase_Dep = false\n')subprocess.run([str(uv), "lock", "--python", sys.executable], cwd=core, env=env, check=True,capture_output=True)- core_packages = {p["name"] for p in tomllib.loads((core / "uv.lock").read_text())["package"]- if "registry" in p.get("source", {})}- assert {"base-dep", "chosen-dep"} <= core_packages and "member-dep" not in core_packages+ core_lock = tomllib.loads((core / "uv.lock").read_text())["package"]+ core_packages = {p["name"]: p["version"] for p in core_lock if "registry" in p.get("source", {})}+ assert {"base-dep", "chosen-dep"} <= set(core_packages) and "member-dep" not in core_packagesroot = tmp / "workspace"ws.lock_and_sync([plug_a], [], root=root, source=core, seed_lock=core / "uv.lock",environment=managed_environment(tmp / "env"))policy = tomllib.loads((root / "pyproject.toml").read_text())["tool"]["uv"]- assert "exclude-newer" not in policy- per_package = policy["exclude-newer-package"]- assert per_package == {name: False if name == "base-dep" else "14 days" for name in core_packages}+ assert "exclude-newer" not in policy and "exclude-newer-package" not in policy+ assert sorted(policy["constraint-dependencies"]) == sorted(f"{n}=={v}" for n, v in core_packages.items())locked = {p["name"] for p in tomllib.loads((root / "uv.lock").read_text())["package"]}- assert "member-dep" in locked and "member-dep" not in per_package+ assert "member-dep" in lockeddiff --git a/tests/pm/test_workspace_build_inputs.py b/tests/pm/test_workspace_build_inputs.pyindex 51122a036fc..d42e02ad696 100644--- a/tests/pm/test_workspace_build_inputs.py+++ b/tests/pm/test_workspace_build_inputs.py@@ -193,8 +193,13 @@ def test_legacy_member_is_generated_only_inside_workspace(tmp_path, monkeypatch)@pytest.mark.parametrize("exact", [False, True])-def test_plugin_can_move_compatible_transitive_but_not_exact_requirement(tmp_path, monkeypatch, exact):- import os+def test_plugin_cannot_move_any_core_locked_package(tmp_path, monkeypatch, exact):+ """Core's lock is the vetted set: a plugin moves neither a core pin nor a transitive one.++ Release age is checked when Hermes locks, so a version core's lock never held was never+ age-checked; a user's machine cannot check it either, since mirrors may serve no upload+ times (#135589). Before, a transitive core package could move within core's ranges.+ """import tomllibcore = tmp_path / "core"@@ -216,8 +221,9 @@ def test_plugin_can_move_compatible_transitive_but_not_exact_requirement(tmp_patbaseline, first_env = tmp_path / "baseline", tmp_path / "first-env"workspace.lock_and_sync([], [], root=baseline, source=core, seed_lock=None,environment=managed_environment(first_env))- first_lock = (baseline / "uv.lock").read_bytes()- assert next(p["version"] for p in tomllib.loads(first_lock.decode())["package"] if p["name"] == "pkgb") == "1.2"+ (core / "uv.lock").write_bytes((baseline / "uv.lock").read_bytes())+ assert next(p["version"] for p in tomllib.loads((core / "uv.lock").read_text())["package"]+ if p["name"] == "pkgb") == "1.2"_fixtures._wheel(wheels, "pkgb", "1.3")plugin = tmp_path / "plugin"plugin.mkdir()@@ -225,21 +231,9 @@ def test_plugin_can_move_compatible_transitive_but_not_exact_requirement(tmp_pat'[project]\nname="plugin-proof"\nversion="1"\nrequires-python=">=3.11"\ndependencies=["pkgb==1.3"]\n',encoding="utf-8",)- extended, candidate = tmp_path / "extended", tmp_path / "candidate"- if exact:- with pytest.raises(workspace.ResolutionConflict):- workspace.lock_and_sync([plugin], [], root=extended, source=core, seed_lock=baseline / "uv.lock",- environment=managed_environment(candidate))- else:- workspace.lock_and_sync([plugin], [], root=extended, source=core, seed_lock=baseline / "uv.lock",- environment=managed_environment(candidate))- installed = tomllib.loads((extended / "uv.lock").read_text(encoding="utf-8"))["package"]- assert next(p["version"] for p in installed if p["name"] == "pkgb") == "1.3"- python = candidate / ("Scripts/python.exe" if os.name == "nt" else "bin/python")- result = subprocess.run([str(python), "-c", "import pkga, pkgb; print(pkga.__version__, pkgb.__version__)"],- capture_output=True, text=True, check=True, timeout=30)- assert result.stdout.strip() == "1.0 1.3"- assert (baseline / "uv.lock").read_bytes() == first_lock+ with pytest.raises(workspace.ResolutionConflict):+ workspace.lock_and_sync([plugin], [], root=tmp_path / "extended", source=core,+ seed_lock=core / "uv.lock", environment=managed_environment(tmp_path / "candidate"))def test_member_uv_lock_travels_with_its_member(tmp_path):diff --git a/tests/test_packaging_metadata.py b/tests/test_packaging_metadata.pyindex 1b610a79a32..4b049f227f3 100644--- a/tests/test_packaging_metadata.py+++ b/tests/test_packaging_metadata.py@@ -51,3 +51,18 @@ def test_starlette_server_pins_and_lock_exclude_cve_2026_48710():assert len(pins) == 1 and pins[0].operator == "==" and Version(pins[0].version) >= floorversions = [Version(row["version"]) for row in lock["package"] if row["name"] == "starlette"]assert versions and all(version >= floor for version in versions)+++def test_every_dependency_is_held_to_one_three_day_release_age():+ """Hermes's deps must be >= 3 days old when locked, exact pins included (Teknium ruling).++ A per-package exemption or date would quietly let a fresh release into the lock; the+ check runs at lock time only, so users never need a mirror that serves upload times.+ """+ manifest = tomllib.loads((REPO_ROOT / "pyproject.toml").read_text(encoding="utf-8"))+ uv = manifest["tool"]["uv"]+ lock = tomllib.loads((REPO_ROOT / "uv.lock").read_text(encoding="utf-8"))+ assert uv["exclude-newer"] == "3 days"+ assert "exclude-newer-package" not in uv+ assert lock["options"].get("exclude-newer-span") == "P3D"+ assert "exclude-newer-package" not in lock["options"]diff --git a/uv.lock b/uv.lockindex 26102d98fd4..adb7e61f476 100644--- a/uv.lock+++ b/uv.lock@@ -11,108 +11,7 @@ supported-markers = [[options]exclude-newer = "0001-01-01T00:00:00Z" # This has no effect and is included for backwards compatibility when using relative exclude-newer values.-exclude-newer-span = "P14D"--[options.exclude-newer-package]-agent-client-protocol = false-aiohttp = false-aiohttp-socks = false-aiosqlite = false-alibabacloud-dingtalk = false-anthropic = false-asyncpg = false-azure-identity = false-boto3 = false-brotlicffi = false-browser-harness = false-certifi = false-concurrent-log-handler = false-croniter = false-cryptography = false-daytona = false-ddgs = "2026-08-26T21:52:34Z"-debugpy = false-defusedxml = false-dingtalk-stream = false-discord-py = false-edge-tts = false-elevenlabs = false-exa-py = false-fal-client = false-fastapi = false-faster-whisper = false-fire = false-firecrawl-anydoc = false-firecrawl-py = false-google-api-python-client = false-google-auth = false-google-auth-httplib2 = false-google-auth-oauthlib = false-google-cloud-pubsub = false-h2 = false-httplib2 = false-httpx = false-httpx2 = false-huggingface-hub = false-jinja2 = false-langfuse = "2026-09-09T16:01:26Z"-lark-oapi = false-markdown = false-maturin = false-mautrix = false-mcp = false-microsoft-teams-apps = false-mistralai = false-modal = false-nemo-relay = false-neutts = "2026-07-22T14:54:23Z"-numpy = false-openai = false-opentelemetry-exporter-otlp-proto-http = false-opentelemetry-sdk = false-packaging = false-parallel-web = false-pathspec = false-pillow = false-piper-tts = "2026-09-04T16:47:32Z"-prompt-toolkit = false-psutil = false-pvporcupine = false-pyasn1 = false-pydantic = false-pyjwt = false-pytest = false-pytest-asyncio = false-python-dotenv = false-python-multipart = false-python-olm = false-python-telegram-bot = false-pyyaml = false-qrcode = false-requests = false-rich = false-ruamel-yaml = false-ruff = false-sentencepiece = false-setuptools = false-setuptools-rust = false-sherpa-onnx = "2026-09-10T17:00:04Z"-sherpa-onnx-core = "2026-09-10T15:58:47Z"-slack-bolt = false-slack-sdk = false-snowballstemmer = false-sounddevice = false-soundfile = "2026-06-06T08:58:48Z"-starlette = false-tenacity = false-ty = false-tzdata = false-unpaddedbase64 = false-uvicorn = false-vercel = false-websockets = false-wheel = false-youtube-transcript-api = false+exclude-newer-span = "P3D"[manifest]overrides = [