Repository navigation
fix(roadmap): import refine at module level to avoid deadlock (#2535) - #2599
Merged
Merged
Conversation
…e its worker threads start, so two lanes no longer deadlock on the pydantic_ai import (#2535)
dan-petty
marked this pull request as ready for review
October 29, 2026 02:28
dan-petty
pushed a commit
that referenced
this pull request
Oct 29, 2026
🤖 I have created a release *beep* *boop* --- ## [0.13.1](v0.13.0...v0.13.1) (2026-10-29) ### Bug Fixes * **roadmap:** import refine at module level to avoid deadlock ([#2535](#2535)) ([#2599](#2599)) ([3731dff](3731dff)) ### Code Refactoring * **review:** retire the unread review guards file ([#2595](#2595)) ([6ae7123](6ae7123)), closes [#1916](#1916) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
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.
Summary
The
roadmap runService starts twoLaneWorkerthreads that each call_run_refine_adapter. That function lazily importeddevops_cli.roadmap.refineinside the thread. The import chain reachespydantic_ai(viarefine_investigation.py). On Python 3.14, two threads importingpydantic_aisimultaneously trigger_DeadlockErrorbecause the import lock is reentrant.This change moves the
refineimport to module level inrun.py. Theservecommand importsrun.pyin the main thread before theLaneWorkerthreads start (serve.py:170), sopydantic_aiis already insys.modulesby the time the threads run. The import lock is acquired once, in the main thread, and the workers skip it.Fail-to-pass
Test
New structural test
test_the_refine_import_is_at_module_level_not_lazy_in_the_adapterintests/test_roadmap_run.pyasserts thatrun.pycontains a module-levelImportFromfordevops_cli.roadmap.refineand that noImport/ImportFromof that module appears inside any function body.Closes #2535