You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 1, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 1, 2026. It is now read-only.
SEA binary resolution uses an expired importlib.resources temporary path #354
_resource_binary_path() returns the path yielded by importlib.resources.as_file() after leaving the context manager. For resources backed by a ZIP importer, that path is a temporary extraction which is deleted when the context exits. resolve_binary_path() then passes the expired path to _copy_to_cache(), where read_bytes() fails.
The cache copy appears to be the intended mechanism for non-filesystem package resources, but it currently happens too late.
Reproduction
The lifetime problem can be reproduced with any ZIP-backed package resource:
Stagehand follows this exact pattern at src/stagehand/_custom/sea_binary.py:60-61, then attempts to read the returned path at line 73.
Expected behavior
The packaged binary should be copied into Stagehand's persistent cache while the as_file() context is still active, or the context lifetime should otherwise cover the copy.
Actual behavior
For a ZIP-backed Traversable, _resource_binary_path() returns a deleted temporary path and local-mode resolution fails before startup.
Why this matters
Normal wheel installs are usually unpacked, which hides the defect. ZIP imports, zipapps, and packaging/deployment systems that expose resources through a non-filesystem loader exercise the temporary-resource path that this code is intended to support.
Prior-art check
I searched open/closed issues and PRs for zipimport, importlib.resources.as_file, packaged resource lifetime, and _resource_binary_path and found no existing report.
Activity