Repository navigation
Let SandboxToolset be deep-copied again - #74525
Merged
potiuk merged 2 commits intoOct 10, 2026
Merged
Conversation
potiuk
approved these changes
Oct 10, 2026
potiuk
left a comment
Member
There was a problem hiding this comment.
LGTM. A module-level lock fits here. It only guards short state checks and is never held during the backend call, so sharing it between toolsets costs nothing. It also matches _CLIENT_BUILD_LOCK in the Modal backend.
I also checked the RC for other per-instance locks with the same deep-copy problem. _InOrder (tools/_from_toolset.py) is created per call inside airflow_tools_from_toolset, and _ContentOff (tools/tracing.py) is a module-level singleton. Neither ends up on an object that Airflow deep-copies.
Drafted-by: Claude Code (Opus 5.5); reviewed by @potiuk before posting
potiuk
marked this pull request as ready for review
October 10, 2026 06:39
potiuk
requested review from
Lee-W,
ashb,
gopidesupavan and
kaxil
as code owners
October 10, 2026 06:39
Lee-W
approved these changes
Oct 10, 2026
Signed-off-by: PoAn Yang <[email protected]>
The lock is process-wide and also protects close and the open re-check, which the previous comment did not say. Generated-by: Claude Opus 5 Claude-Session: https://claude.ai/code/session_014np1fVAxHmGaBFt3qebJ8x
potiuk
force-pushed
the
fix-common-ai-sandbox-toolset-deepcopy
branch
from
October 10, 2026 07:06
533a01b to
20d891d
Compare
This was referenced Oct 14, 2026
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.
In #73898,
SandboxToolset.__init__creates athreading.Lock, and a lock cannot be deep-copied. As a result,copy.deepcopy()on aSandboxToolset, or on an operator that holds aSandboxToolset, raisesTypeError: cannot pickle '_thread.lock' object. This didn't happen in 0.10.0.This PR moves the lock to module level, so every
SandboxToolsetshares one lock. The Modal backend already keeps its_CLIENT_BUILD_LOCKat module level. The shared lock is not held during a backend call, so one toolset doesn't wait for another toolset's sandbox.Was generative AI tooling used to co-author this PR?