fix(daemon_pool): support Python 3.14 WorkerContext API - #81118
fix(daemon_pool): support Python 3.14 WorkerContext API#81118jcrabapple wants to merge 1 commit into
Conversation
CPython 3.14 removed ThreadPoolExecutor._initializer / _initargs and replaced them with a WorkerContext pattern, and _worker() changed from 5 args to 3. Detect the available API at runtime and branch accordingly so DaemonThreadPoolExecutor works on both 3.8-3.13 and 3.14+. Fixes 'DaemonThreadPoolExecutor' object has no attribute '_initializer' on Python 3.14 (Fedora 44, etc.).
|
Independent verification of this fix (Python 3.14.4, Linux x86-64, 2026-08-10). I independently hit the same crash —
Key detail worth noting in the fix: the crash is NOT only in No changes requested to this PR — just confirming the fix is correct and load-bearing from an independent run. Happy to add the regression tests here if useful. |
CPython 3.14 removed
ThreadPoolExecutor._initializer/_initargsand replaced them with aWorkerContextpattern, and_worker()changed from 5 args to 3. This breaksDaemonThreadPoolExecutoron any system running Python 3.14 (Fedora 44, etc.) with:This manifests in the CLI as intermittent tool-call failures during parallel operations (skill_view, web_search, search_files, and any other concurrent tool dispatch).
The fix detects the available API at runtime via
hasattr(self, '_initializer')and branches accordingly — old path for 3.8–3.13, new WorkerContext path for 3.14+. Verified on both Python 3.11 and 3.14.The daemon pool never passes a custom initializer, so
None/()is the correct equivalent in the 3.14 path.