fix(py): release the GIL while a build runs, so progress callbacks do not deadlock #2954
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 211 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.320
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2954"
general
weight: 0.35
wolfv
Fixes #2952.
What
RenderedVariant.run_build(..., progress_callback=cb)hangs since 0.77.0. Since #2843 every build runs on its own tokio task, so log events reach the Python callback from a runtime worker thread, wherePython::attachwaits for the GIL. The caller kept the GIL while blocking on the runtime, so neither side could continue.build_rendered_variant_pynow releases the GIL (py.detach) while the build runs. The log capture is unchanged and still runs on the calling thread; only the wait happens without the GIL.Side effects:
run_build. That has been the case since #2843 (it is why the hang happens); calls are still serialized by the GIL.Tests
test_run_build_with_progress_callback: builds a small recipe with a callback in a child process with a 120 s timeout, so a deadlock fails the test instead of hanging the suite, and checks that the callback received events. On main it times out; with this PR it passes.pkgs/main) and on main (7c0a5e1d), completes in about 1 s with this PR. Without a callback, all of them complete.cargo fmt --check,cargo clippy --all-targets -- -D warnings,ruff checkandruff format --checkpass locally on macOS.---
This PR (code and description) was AI-generated with Claude Opus 5.5 (
claude-opus-5-5) and reviewed before opening.🤖 Generated with Claude Code