The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(pm): re-merge the uv cache seed on volumes marked by a seedless image
ethernet1226894bf9bd
diff --git a/pm/packages.py b/pm/packages.pyindex 81902c6f57b..9ec2b07c72e 100644--- a/pm/packages.py+++ b/pm/packages.py@@ -347,6 +347,12 @@ def uv_cache_dir() -> Path:# from the network (and built sdists where the index has no wheel for the target).lock = repo_root() / "uv.lock"seed = _uv_lock_digest(lock).hex() if lock.is_file() else "1"+ # The marker also records whether a payload cache was present. An image without one still+ # writes the marker for its lock, and a later image with the same lock must still merge its+ # seed. Do not drop the suffix: the lock alone cannot tell those two images apart.+ payload_cache = long_root(store_root().parent / "uv-cache")+ if payload_cache.is_dir():+ seed += "+payload"try:current = marker.read_text(encoding="utf-8-sig").strip() == seedexcept OSError:@@ -359,7 +365,6 @@ def uv_cache_dir() -> Path:try:# uv's cache trees run deep; both roots get the long spelling so# the copy is not cut at MAX_PATH. The returned path stays ordinary.- payload_cache = long_root(store_root().parent / "uv-cache")if payload_cache.is_dir():seeded = long_root(machine_cache)seeded.mkdir(parents=True, exist_ok=True)diff --git a/tests/pm/test_uv_cache_seed.py b/tests/pm/test_uv_cache_seed.pyindex 1c216e9d26c..f035816d93e 100644--- a/tests/pm/test_uv_cache_seed.py+++ b/tests/pm/test_uv_cache_seed.py@@ -104,3 +104,21 @@ def test_retry_recopies_a_file_the_interrupted_seed_left_short(payload_cache):packages.uv_cache_dir()assert short.read_text(encoding="utf-8") == "seeded = True\n"assert (payload_cache / ".seeded").is_file()+++def test_marker_from_a_seedless_image_does_not_block_a_later_seed(payload_cache, tmp_path, monkeypatch):+ """An image without ``uv-cache/`` still writes ``.seeded`` for the current lock. The next image+ ships the seed with the same lock, and its wheels must still reach the volume."""+ code = tmp_path / "code"+ code.mkdir()+ (code / "uv.lock").write_text("version = 1\n", encoding="utf-8")+ monkeypatch.setattr(paths, "repo_root", lambda: code)+ seed = paths.store_root().parent / "uv-cache"+ seedless = tmp_path / "uv-cache-hidden"+ seed.rename(seedless)+ packages.uv_cache_dir()+ assert (payload_cache / ".seeded").is_file()++ seedless.rename(seed)+ packages.uv_cache_dir()+ assert (payload_cache / "archive-v0" / "bucket" / "module.py").is_file()