Preserve sandbox capabilities through snapshot/recycle/restore#191
Merged
seanwevans merged 1 commit intomainfrom Apr 21, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
SandboxThread.snapshot()viaserialize_capabilities(...)so snapshots include reconstructible capability data instead of only keys. (pyisolate/runtime/thread.py)deserialize_capabilities(...)and use it when initializing orreset(...)ing sandbox threads so both live capability objects and snapshot payloads are accepted. (pyisolate/runtime/thread.py)Supervisor.recycle()to forwardcapabilities=snap["capabilities"]intospawn(...)so recycled sandboxes retain their original capability grants. (pyisolate/supervisor.py)spawn(...)so restored sandboxes preserve handed capabilities. (pyisolate/checkpoint.py)test_recycle_preserves_capabilities(intests/test_supervisor.py) andtest_checkpoint_restores_capabilities(intests/test_checkpoint.py) to validate capability-preservation across recycle and restore. (tests/*)Testing
pytest -q tests/test_supervisor.pyand observed23 passed.pytest -q tests/test_checkpoint.pyand observed13 passed.pytest -q tests/test_capabilities.pyand observed7 passed.tests/test_supervisor.py::test_recycle_preserves_capabilities,tests/test_checkpoint.py::test_checkpoint_restores_capabilities, andtests/test_capabilities.py::test_filesystem_capability_allows_only_handed_pathsand observed all 3 passed.Codex Task