fix(tools): Python 3.14 compatibility for DaemonThreadPoolExecutor - #3
Open
djbclark wants to merge 1 commit into
Open
fix(tools): Python 3.14 compatibility for DaemonThreadPoolExecutor#3djbclark wants to merge 1 commit into
djbclark wants to merge 1 commit into
Conversation
Python 3.14 removed _initializer / _initargs from ThreadPoolExecutor, replacing them with _create_worker_context() and changing _worker() from 4 args to 3. DaemonThreadPoolExecutor._adjust_thread_count() still referenced the old API, causing AttributeError on Python 3.14. Add a version guard that uses the 3.14+ API when available and falls back to the 3.13- API otherwise. Fixes NousResearch#69359, obsoletes NousResearch#57459 (which used getattr fallback that still passes the wrong number of args to 3.14's _worker). Tested: passes on both Python 3.13 and 3.14.
djbclark
pushed a commit
that referenced
this pull request
Aug 11, 2026
… (re-review #3) The last_activity_at/description/provenance columns already live in SCHEMA_SQL and the column reconciler; existing DBs heal via the reconciler, but the version stamp must advance so downgrade/upgrade tooling sees the new layout. No version-literal test assertions exist (tests compare against the imported constant).
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.
Problem
Python 3.14 removed
_initializer/_initargsfromThreadPoolExecutor.__init__, replacing them with_create_worker_context(). The_workerfunction signature also changed from 4 args to 3.DaemonThreadPoolExecutor._adjust_thread_count()still referenced the old API, causing:This breaks
read_file,search_files,skill_view, and other tools that use the thread pool for dispatch.Fixes: NousResearch#69359, NousResearch#58596
Fix
Version-guarded branch that uses
_create_worker_context()on Python 3.14+ (3-arg_worker) and the existing_initializer/_initargspath on Python 3.13- (4-arg_worker).Why not the approach in NousResearch#57459?
PR NousResearch#57459 uses
getattr(self, '_initializer', None)which avoids theAttributeErrorbut still passes 4 args to_worker. On Python 3.14,_workertakes only 3 args — so it would fail withTypeError: _worker() takes 3 positional arguments but 4 were given.Testing
DaemonThreadPoolExecutor.submit(lambda: 42).result()returns 42read_file,search_files,skill_viewall work after applying this patchMigrated from upstream PR NousResearch#74452.