Add an opt-in free-threaded search executor - #10
Draft
senegrom wants to merge 9 commits into
Draft
Conversation
senegrom
force-pushed
the
agent/free-threaded-search-executor
branch
from
August 13, 2026 16:19
e686e40 to
80b594d
Compare
senegrom
marked this pull request as ready for review
August 13, 2026 20:26
senegrom
marked this pull request as draft
August 13, 2026 22:10
Brings in the capped-undercount fix, the extension-rule sandbox, the depth-gate retirement, and the restored negative-results ledger, and adapts the opt-in thread executor to them: - All depth_gate plumbing removed from the thread path (solve(), _solve_validated_thread, _solve_top_threaded, solve_thread_trials, _ThreadBranchRunner, _solve_full_cancellable, and their tests), matching the retirement on master. - Both threaded call sites of _atomic_pass_or_branches now pass allow_overlapping_guarantee_branches=max_sols == -1, mirroring the sequential and process paths. The cancellable recursion previously carried the pre-fix branching verbatim, so a positive cap could re-enter the capped undercount through mid-depth guarantee branches; the top-level full-cap-per-branch consumption only masked the top-level case. The historical wording in the branch's two benchmark records is kept verbatim per the ledger policy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K4voGGQ5AHaCkDr4JAZXv9
Two regressions for the undercount family on the thread path, which the branch predated: an end-to-end capped thread solve over overlapping at-least-once guarantees (15 solutions, cap 10 must return 10), and a direct call of the cancellable recursion asserting set equality with the sequential capped subset — the top level's full-cap-per-branch consumption can mask the recursion's behaviour, so the mirror is pinned on its own. The two executor benchmark records from 2026-08-12 join the verdict index. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K4voGGQ5AHaCkDr4JAZXv9
Brings the branch up to date with the September work on master: the capped/parallel oracle tests, ruff simplifications, Dependabot and action bumps, the deterministic weekly corpus selections, PR 16 (implicit-clique branch pressure, cage dictionary parsing, pool exception cleanup, output encoding, wheel smoke test), PR 17 (exact staircase cage partitions, write-once size fields, single-pass loop pruning), PR 19 (iterative partition DFS, uncapped failure observer) and the checkout-runnable failure probes. Clean auto-merge; the only shared files were benchmarks/README.md and logger.py, in disjoint regions. The thread executor needs no adaptation: solve_threaded.py already cancels and terminates on any exception, and the shared branch-choice change applies to both backends identically. Full suite in the merged tree: 659 passed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01US1sGacWn9pHbhJyynAG4y
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
Add an explicit free-threaded top-level search executor while keeping process execution as the default. The final implementation is direct source, tests, documentation, and durable benchmark evidence; the encoded experiment payload and all one-use export/validation workflows have been removed.
Design
parallel_backend="process" | "thread"tosolver.solve()and--parallel-backendto the CLI.processes > 1and CPython is a free-threaded build with the GIL actually disabled.The public usage and extension contract is documented in
FREE_THREADED.md.Correctness validation
The exact promoted source passed the complete bounded suite on both runtimes:
Coverage includes sequential/process/thread solution equivalence, deterministic positive caps, caller-state preservation, runtime rejection with a normal GIL, private worker rule graphs, fresh task grids, cache stripping, exception cleanup, bounded submission, cancellation, statistics merging, and context-local logging.
Normal repository CI and forward-compatibility CI also pass on the cleaned direct-source head.
Performance validation
All solver benchmarks used
depth_gate=None, alternating run order, and exact deterministic solution fingerprints.Default sequential/process path against
masterThread executor against the process executor on Python 3.14t
The decisive optimization was isolating cooperative cancellation in the thread-only recursion. The earlier candidate polled an optional cancellation event at every ordinary recursive search node, which measurably regressed the default path.
Benchmark reports and machine-readable samples are committed under
benchmarks/.Open correctness items before merge
max_sols. The returned solutions are valid and repeatable, but they are not guaranteed to be the globally smallest solutions by_solution_key. The currentsolver.solve()docstring overstates this by saying parallel runs keep the smallest solutions by content key. Either document the existing branch-priority/early-cancellation contract or compute every branch before selecting a canonical global top-N; the latter would defeat the main purpose of a small positive cap.FREE_THREADED.md.Gridand Sudoku. Before merge, add direct thread-mode equivalence coverage for the built-in compact and cage families and a concurrent multi-solve stress case under a genuinely GIL-disabled runtime.