Skip to content

Conversation

@dsfaccini
Copy link

Summary

Test plan

🤖 Generated with Claude Code

sys.monitoring callbacks (PEP 669) are global and fire on all threads.
When tools like coverage register branch callbacks, they can trigger
lazy imports inside the sandbox on Python 3.14+, causing
RestrictedWorkflowAccessError and hanging the workflow.

Suspend all sys.monitoring events while the sandbox importer is active
and restore them on exit. Uses reference counting so concurrent sandbox
activations from multiple worker threads correctly share state.

Fixes temporalio#1326

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@dsfaccini dsfaccini requested a review from a team as a code owner February 11, 2026 23:39
@CLAassistant
Copy link

CLAassistant commented Feb 11, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sys.monitoring callbacks (coverage, etc.) cause workflow sandbox hang on Python 3.14

2 participants