Repository navigation
Reduce PDIRK statistics after worker joins without a global lock - #4465
ChrisRackauckas-Claude wants to merge 13 commits into
Conversation
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI 0.153.4 Agent-Model: gpt-6-astra Agent-Session: local session ID 01a07106-6c33-7603-9aa9-e3d9aec293f1
Keep nonlinear statistics and Jacobian evaluation state private to each solver, then merge counters and failure status in the parent at each PDIRK join. Use the same two-solver stage ordering in serial and threaded modes and retain private snapshots of out-of-place stage results. Cover default and alternative nonlinear solvers, failed stages, and always-new Newton with four threads. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI 0.153.4 Agent-Model: gpt-6-astra Agent-Session: local session ID 01a07106-6c33-7603-9aa9-e3d9aec293f1
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: Devin CLI 3000.11.3 (conflict resolution), Claude Code 2.1.285 (orchestration) Agent-Model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium Agent-Session: local Claude session 3c311569-dda6-4687-bc9f-65febb212c33 (fleet master); Devin log /Users/chrisrackauckas/sandbox/master/fusion-fixes/SciML_OrdinaryDiffEq.jl-4465/log.txt # Conflicts: # lib/OrdinaryDiffEqCore/Project.toml # lib/OrdinaryDiffEqCore/test/runtests.jl # lib/OrdinaryDiffEqDifferentiation/Project.toml # lib/OrdinaryDiffEqNonlinearSolve/Project.toml # lib/OrdinaryDiffEqNonlinearSolve/src/OrdinaryDiffEqNonlinearSolve.jl # lib/OrdinaryDiffEqNonlinearSolve/src/newton.jl # lib/OrdinaryDiffEqNonlinearSolve/src/utils.jl # lib/OrdinaryDiffEqPDIRK/Project.toml # lib/OrdinaryDiffEqPDIRK/test/runtests.jl
Merged the default branch into this PR to resolve conflicts (head 069d6bf). Re-review the resolution before merging. Conflict resolution reportSTATUS: RESOLVED Merge of Conflicting files and resolution
Runic ( TestsEnvironment: a scratch env at
Each command was run from the repo root as
Logs: Note for review (not changed)
Links🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (merge), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium |
OrdinaryDiffEqCore 4.19.0 and OrdinaryDiffEqPDIRK 2.5.3 were registered from master without this PR's changes, so the new Core API ships as 4.20.0 and PDIRK as 2.6.0; Differentiation, NonlinearSolve and PDIRK require Core 4.20. NonlinearSolve now requires the unregistered Differentiation 3.13 and PDIRK the unregistered NonlinearSolve 2.10, so CI resolution (sublibrary, LTS develop_sources and downgrade jobs, including StochasticDiffEqLeaping and StochasticDiffEqWeak through NonlinearSolve) failed with "Unsatisfiable requirements". Add the in-repo [sources] path entries the other sublibraries use. Move the build_nlsolver stats_delta note into a keyword section below the summary line. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Agent-Harness: Claude Code 2.1.301 Agent-Model: claude-opus-5-5 Agent-Session: local session ID 64ecc481-5cba-4f73-b4a5-c0439586a793 (headless claude -p, no URL)
drain_jvp_count! added Jacobian-vector product evaluations straight to integrator.stats.nf from dolinsolve, so threaded PDIRK workers using a Jacobian-free Krylov W raced on the shared counter: with KrylovJL_GMRES() and concrete_jac = false, all 30 threaded solves reported nf between 2350 and 2384 against the serial 2398. dolinsolve and drain_jvp_count! take a stats_sink keyword; Newton passes its cache's StatsDelta. The default nothing keeps the direct increment_nf! path for every other caller. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Agent-Harness: Claude Code 2.1.301 Agent-Model: claude-opus-5-5 Agent-Session: local session ID 64ecc481-5cba-4f73-b4a5-c0439586a793 (headless claude -p, no URL)
Select the in-repository Core required by Differentiation 3.13 when activating the two QA environments. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI 0.162.1 Agent-Model: gpt-6.1-sol Agent-Session: local job pdirk-stats-race-codex (no session URL)
Investigated head The issue MWE reproduces the race with four Julia threads: six master threaded solves report different counters. At this PR head, six threaded solves and six serial solves all report Findings for the six red checks:
The follow-up commit The buffer-and-join design is appropriate; I found no fundamental defect requiring a replacement branch. The HIGH risk review still matters because the PR changes shared implicit-solver code and serial PDIRK’s cache schedule. Independent review is still needed. Links
🤖 Posted by an AI agent — harness: Codex CLI 0.162.1 · model: gpt-6.1-sol (investigation); reviewed and posted by Claude Code 2.1.302 · model: claude-opus-5-5 |
Findings review by Codex CLI (gpt-6.1-sol), run in a fresh session. It is a findings review, not a counted independent rating: the PR has commits by a human contributor without agent trailers (unknown author) and by gpt-6.1-sol, so the review's model authored commits (risk.md, Independent reviews). Its blocking finding was reproduced by the fleet master's tick agent: the reviewer's reproducer fails on the PR head and passes on the control (merge-base or master). VERDICT: CHANGES Riskhigh (H1: unchanged calls through the public nonlinear-solver factory reject existing positional extensions). Blocking findings
Non-blocking findingsNo additional confirmed findings. What I ranReviewed head All Julia validation used Julia 1.12.7 and workspace temporary storage: export TMPDIR=<local path>
J=julia
S=<local path>
export JULIA_PKG_PRECOMPILE_AUTO=0Unmodified head/master archives and local environments were created under GROUP=Core julia +1.12 --threads=4 --project=<scratch>/head/lib/OrdinaryDiffEqPDIRK -e 'using Pkg; Pkg.instantiate(); Pkg.test()'
GROUP=Core julia +1.12 --threads=4 --project=<scratch>/head/lib/OrdinaryDiffEqDifferentiation -e 'using Pkg; Pkg.instantiate(); Pkg.test()'
GROUP=Core julia +1.12 --threads=4 --project=<scratch>/head/lib/OrdinaryDiffEqNonlinearSolve -e 'using Pkg; Pkg.instantiate(); Pkg.test()'
GROUP=QA julia +1.12 --threads=4 --project=<scratch>/head/lib/OrdinaryDiffEqCore -e 'using Pkg; Pkg.instantiate(); Pkg.test()'
GROUP=QA julia +1.12 --threads=4 --project=<scratch>/head/lib/OrdinaryDiffEqPDIRK -e 'using Pkg; Pkg.test()'
Logs are retained under What I did not verify
Links:
🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5 (review text by Codex CLI gpt-6.1-sol, local job) |
Forward the statistics keyword only for buffered solvers and document the extension contract. Exercise positional and buffer-aware custom factories through in-place and out-of-place PDIRK solves. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI Agent-Model: gpt-6.1-sol Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4465 (no session URL)
H1 is addressed in 97befc690c: unbuffered forwarding supports positional-only factories, and buffering has an explicit extension contract. The external-client regression reports 62 passes and 2 errors before the fix, then 96 passes after. Full validation and independently reproduced default-branch failures are recorded in the PR body. 🤖 Posted by an AI agent — harness: Codex CLI · model: gpt-6.1-sol |
Independent review at head Fleet master spot-check against the head source: VERDICT: CHANGES Riskhigh (H1: default threaded PDIRK rejects existing public positional-only nonlinear-solver factories). Blind rating (written before reading the author's): high (H1: threaded PDIRK now requires existing custom build_nlsolver factories to accept stats_delta, rejecting previously supported positional factories) Final rating unchanged: execution confirms the compatibility break. The change reaches shared Jacobian, linear-solve and nonlinear-solve machinery used by the Rodas and FBDF main lanes, plus PDIRK. G1 has independent analytic accuracy evidence on the successful paths; G3 has discriminating four-thread counter, failure and private-state tests. Those successes do not resolve the findings below. Rating eligibility: this is a findings review, not a counted rating under Blocking findings
Non-blocking findings
What I ranReviewed head All Julia runs used 1.12.7, workspace temporary storage, at most four Julia threads, and separate source copies/environments with local sibling packages. Definitions for the commands below: export TMPDIR=<review dir>/tmp
export JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=4 JULIA_PKG_PRECOMPILE_AUTO=0
J=<juliaup julia>
S=<review scratch dir>For each of Core, Differentiation, NonlinearSolve and PDIRK: GROUP=Core "$J" +1.12 --project="$S/head/lib/OrdinaryDiffEq<Sub>" \
-e 'using Pkg; Pkg.instantiate(); Pkg.test(; allow_reresolve=false)'Repeated with
Additional commands used
The original checkout is unchanged. All started commands and the baseline investigator have finished. No commits, pushes, GitHub comments, or other GitHub mutations were made. Logs and probes are retained in What I did not verify
Links
🤖 Posted by an AI agent — harness: Codex CLI 0.163.0 (review) · model: gpt-6.1-sol; posted by Claude Code 2.1.302 · model: claude-opus-5-5 for the fleet master |
Findings review by Devin CLI (Fusion: Claude Opus 5.5 with SWE-2), run in a fresh session at head 282f485; the branch has since moved to 97befc6, so findings may be stale. It is a findings review, not a counted independent rating: the PR has commits authored by the same Fusion model (risk.md, Independent reviews). VERDICT: CHANGES Riskmedium (M2: serial Blocking findings
Non-blocking findings
What I ranJulia 1.13.2 unless noted. Environments developed from
What I did not verify
Links
🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5 (review text by Devin CLI, fusion-claude-opus-5-5-high-sidekick-swe-2-medium, local job) |
Keep the one-solver serial stage schedule and buffer the built-in solver returned by a positional-only factory for threaded stages. Retain master's threading option handling and test it with deterministic one-thread statistics references. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI Agent-Model: gpt-6.1-sol Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4465 (no session URL)
The three blocking findings in this review are addressed in 446d69dac0: positional-only factories succeed with threaded PDIRK and TRBDF2 coverage; a normal merge retains master's threading-option fix/tests; serial PDIRK retains master's one-cache schedule and the 50-state counters, checked against physical RHS calls. The same regression files fail against the original head (175 passes, 2 failures, 4 errors), then pass after the fix (221 assertions). Full PDIRK Core passes 4,488 assertions, including 4,244 concurrency assertions; PDIRK QA, NonlinearSolve QA, docs, Runic, and typos pass. The appended review's out-of-place always-new Newton regression fails on clean master (3 passes, 2 failures) and passes here (5/5). NonlinearSolve Core reaches the independently reproduced default-branch line-search exception after passing its developer API and new state tests. Commands, output, baseline comparisons, and coverage limits are in the new PR-body evidence section. No test was disabled or loosened. An eligible independent review remains required; the overall high risk assessment is retained. Next counted review must come from a model that authored no commit in this PR (risk.md § Independent reviews). Links:
🤖 Posted by an AI agent — harness: Codex CLI · model: gpt-6.1-sol |
Combine the upstream _calc_J!/_jacobian!/_calc_W! alg dispatch and dolinsolve alg keyword with the StatsDelta sink and next_u plumbing, and compute the always_new Jacobian state with _stage_of_z into private cache storage. Bump OrdinaryDiffEqCore to 4.21.0 and OrdinaryDiffEqDifferentiation to 3.14.0 above the upstream releases. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Muse <[email protected]> Agent-Harness: Muse CLI Code Agent-Model: muse-wonder-full-1.0 Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4465 (no session URL)
Declare the local Core source once in each affected QA project. Describe the statistics sink contract without a performance claim. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI 0.170.0 Agent-Model: gpt-6.2-sol Agent-Job: SciML__OrdinaryDiffEq.jl__4465--20261122T053756Z-codex-gpt-6.2-sol Agent-Session: local session 01a201c3-092f-7d73-8636-6f243e9ecf35 (no session URL)
PDIRK workers can lose statistics and overwrite shared failure/Jacobian state. Give each concurrent nonlinear solver a typed private
StatsDelta, then reduce counters in solver order and assign failure status once in the parent after every join, including failed stages. This revises #4351, preserving its author history; the original contributor branch is not writable by this account.The global lock and generic postamble drain are removed. PDIRK explicitly requests buffering; serial caches specialize on
Nothing. Newton, Functional, Anderson, NonlinearSolveAlg, and Homotopy use the sink. Serial and threaded PDIRK follow the same two-cache stage schedule; out-of-place stages retain snapshots, and always-new Newton evaluates Jacobians with private state instead of writingintegrator.u.Ignore until reviewed by @ChrisRackauckas. This remains a draft with the QA and registration blockers below.
Failing before / passing after
Julia 1.10.12, four threads. The same committed regression file was run against clean original PR head
ce086b1780c3a2bede9b008f2d6ff6dabcdd922eand this implementation, using separate local environments pointing at the respective checkouts:Before:
After:
The test repeats each serial/threaded comparison 30 times, compares every DEStats field and solutions for in-place and out-of-place problems, and covers five nonlinear solver choices, failure at either join, and always-new Newton. The official runner ensures at least four Julia threads; its additional thread-count assertion makes 2113 assertions in the threaded testset.
Local verification
All commands use a workspace TMPDIR,
JULIA_PKG_PRECOMPILE_AUTO=0, and local environments with the changed sibling packages developed together.juliabelow isjulia.The full NonlinearSolve
GROUP=Coresuite passed on Julia 1.10.12: 912 passed, 40 existing broken assertions across 26 testsets. A supplementary Julia 1.12.7 run was stopped after the required Julia 1.10 suite completed; no Julia 1.12 nonlinear-suite pass is claimed. Differentiation QA passed JET (1) and 16 Aqua assertions, with one isolated-install error described below.Differentiation: 159 assertions. Core QA: 48 passed, one existing broken assertion. Core statistics helper tests: 19 passed. Runic, typos over changed files, and
git diff --checkpassed.julia +1.12.7 --project=OrdinaryDiffEq.jl/docs -e 'using Pkg; Pkg.resolve(); include("OrdinaryDiffEq.jl/docs/make.jl")'Docs completed with exit 0; Documenter reported HTML/search-index size warnings and skipped deployment outside CI.
CI Runic, Typos, documentation, and Differentiation LTS checks passed. Reviewed sublibrary Core/QA and downgrade failures stop at dependency resolution for the pending sibling releases; examples: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/33963432816/job/101300313953 and https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/33963432816/job/101300315157. CI is not green.
Remaining gates and review considerations
🤖 Generated with Codex CLI 0.153.4 (model: gpt-6-astra; local session 01a07106-6c33-7603-9aa9-e3d9aec293f1 (no session URL)). No shareable conversation URL is exposed by this local harness.
Risk assessment
OrdinaryDiffEqDifferentiationorOrdinaryDiffEqNonlinearSolve, not just PDIRK. The PR changes hownf,nw,njacs,nsolveandnnonliniterare counted incalc_J/calc_W/jacobian!and in the NLNewton, Functional, Anderson, NonlinearSolveAlg and Homotopy solvers. It also changes whatpostamble!does withforce_stepfailand adds a type parameter to every NL solver cache struct. A second change is not confined to PDIRK either:always_newNewton no longer writesintegrator.uduring iterations, so it now evaluates the Jacobian throughustepin place ofintegrator.u, and anything holding a reference to that state (for example a lazyWOperator/JacVec) is affected. Serial PDIRK (threading=false) now builds two nonlinear solvers instead of one. That changes memory use, W reuse, and the statistics serial users get back, yet PDIRK only gets a patch bump (2.5.3). The PR needs Core 4.17, Differentiation 3.12 and NonlinearSolve 2.10 registered in that order before it can resolve.9c3d8c31(CI from 2026-09-05) has 19 failing checks. They all stop atUnsatisfiable requirementsbecause of this PR's compat bumps to sibling versions that aren't registered yet:sublibrary-ci:OrdinaryDiffEqPDIRKCore (1, lts, pre) and QA;OrdinaryDiffEqNonlinearSolveCore (1, lts, pre), QA and ModelingToolkit;StochasticDiffEqLeapingCore and QA;StochasticDiffEqWeakCore and QA;OrdinaryDiffEqFeaginQA;OrdinaryDiffEqTaylorSeriesQA.downgrade-sublibraries:OrdinaryDiffEqNonlinearSolve,OrdinaryDiffEqPDIRK,StochasticDiffEqLeaping,StochasticDiffEqWeak.StochasticDiffEqLeapingandStochasticDiffEqWeakCore and QA pass in https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/33955046886, which is the PR basec241543c. All four downgrade jobs pass in https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/36311609544 (8b3a3b07).mergeable_state: dirty(merge conflicts) and 134 commits behind master. Master has since addedOrdinaryDiffEqPDIRKto NonlinearSolve's test target, so it will conflict.StatsDelta,stats_sink,stats_owner,charge_*!,merge_stats_deltas!) and the newnext_ukeyword in Differentiation get minor bumps, which is correct. PDIRK's serial behavior and statistics change under a patch bump, and the description doesn't present that as a behavior change for users.[sources.OrdinaryDiffEqCore]added to the QA envs of unrelatedOrdinaryDiffEqExtrapolationandOrdinaryDiffEqIMEXMultistep, and to NonlinearSolve's mainProject.toml; a newlib/OrdinaryDiffEqPDIRK/AGENTS.md; the Feagin and TaylorSeries QA failures.build_nlsolverdocstring now puts thestats_deltaparagraph before the summary line.SciMLBase.has_statsand_unwrap_valwere already in use.NonlinearSolve(MIT) is added only as a test dependency.🤖 Risk assessment posted by an AI agent (fleet master) — harness: Devin CLI / fusion-claude-opus-5-5-high-sidekick-swe-2-medium; dispatched by Claude Code head, model claude-opus-5-5[1m]
Conversation: local Claude Code session 3cd6500a-1f81-46b5-ac0b-c466e15b6a53 (session ID, no URL)
Agent follow-up (2026-10-16)
Two commits on top of the previous head 7226562; the 10-13 conflict-resolution merge (069d6bf) was re-reviewed hunk by hunk with
git show --remerge-diffand is correct (master'smark_jacobian_updated!andJ_tkept alongside the sink calls;NonlinearSolveCacheargument order matches the struct).CI resolution failures (15 of the 16 red checks).
OrdinaryDiffEqCore4.19.0 andOrdinaryDiffEqPDIRK2.5.3 have since been registered from master without this PR's code, and NonlinearSolve/PDIRK required unregistered siblings without[sources]entries, so sublibrary (1, lts), QA, ModelingToolkit and downgrade jobs for NonlinearSolve, PDIRK, StochasticDiffEqLeaping and StochasticDiffEqWeak stopped atUnsatisfiable requirements.[sources]path entries: NonlinearSolve → Differentiation; PDIRK → Core, Differentiation, NonlinearSolve. Leaping and Weak pick up Differentiation through NonlinearSolve's sources (Pkg on 1.11+ and SciML'sdevelop_sources.jlon LTS both follow a path dependency's runtime sources).JVP statistics race (bug in this PR's scope).
drain_jvp_count!, from master's #4287, added Krylov JVP evaluations straight tointegrator.stats.nffromdolinsolve, bypassing the per-solverStatsDelta.dolinsolveanddrain_jvp_count!now take astats_sinkkeyword (defaultnothingkeeps the existingincrement_nf!path for every other caller); Newton passes its cache's sink. New testset inthreaded_stats_tests.jl(KrylovJL_GMRES(),concrete_jac = false; LinearSolve, MIT, added as a PDIRK test dependency).Failing before the fix (Julia 1.13.2, 4 threads,
GROUP=Core):Passing after:
Serial
nfis 2398 both before and after; only the threaded count changed.build_nlsolverdocstring:stats_deltamoved into a# Keyword argumentssection below the summary line.Verification
All runs: Julia 1.13.2 unless noted,
JULIA_NUM_THREADS=4,Pkg.test()through each lib'stest/runtests.jl.[sources]; 1.10.12 via SciML'sdevelop_sources.jl)Unsatisfiable requirements; after: 10 of 10 resolveGROUP=CoreGROUP=Core, Julia 1.10.12 (LTS)GROUP=CoreGROUP=CoreGROUP=QA: PDIRK, NonlinearSolve, Differentiation, Core@test_brokencounts only)GROUP=Coretyposon changed filesDocs were not built locally; the docstring edits add no
@reflinks or public names.Pre-existing NonlinearSolve
GROUP=Corefailures CI will now show (that job never ran on this PR before because resolution failed). Each was reproduced with master's NonlinearSolve against the same registry versions (SDIRK 2.9.8, BDF 2.4.13, NonlinearSolve 4.32.0, LineSearches 7.8.2) with identical numbers:newton_tests.jl:LineSearchExceptionforTrapezoid(nlsolve = NLNewton(relax = BackTracking())); tracked in Newton BackTracking test fails on master since 498c765ccc (calc_dt_propose! dt rounding) #4681. This testset aborts the runner, so CI will not reach the later testsets.nsa_jacobian_reuse_tests.jl:66:KenCarp4(nlsolve = NonlinearSolveAlg(NewtonRaphson()))naccept45869 vs 35768 reference (bound 1.25×); untracked.nsa_noinit_tests.jl:78: TRBDF2 with each SimpleNonlinearSolve inner algorithm on the mass-matrix Robertson problem returnsMaxIters; untracked.Not changed / for the reviewer
Core4downstream: EnzymeAssertionError: mi2 !== nothingin theEnsembleThreads+Tsit5test. It fails the same way on an unrelated PR run with master's NonlinearSolve 2.9.9 (https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/38872050698/job/116878200138); not caused by this PR.lib/OrdinaryDiffEqPDIRK/AGENTS.md(the only AGENTS.md in the repo) and the[sources.OrdinaryDiffEqCore]entries in the Extrapolation and IMEXMultistep QA environments (from the original contributor's commit) are kept; drop them if unwanted.🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5
Conversation: local session ID 64ecc481-5cba-4f73-b4a5-c0439586a793 (headless, no URL)
Fix by Codex gpt-6.1-sol (head 97befc6)
Forward
stats_deltaonly when buffering is requested at bothbuild_nlsolverforwarding layers. Positional-only custom factories work on the unbuffered path; buffered extensions must accept and honor the keyword. The docstring states that contract. A public-API external-client regression covers in-place and out-of-place PDIRK, positional and buffer-aware factories, solutions, every statistics field, and rejection of a positional-only factory when buffering is requested. No dependencies or test assertions were weakened or disabled.Failing before / passing after
The regression was written before the production fix and run against unfixed
282f4851c8from a workspace copy. Runic applied whitespace formatting when it was added to the official runner. Observed before:After the fix, the committed regression was run with:
Validation
Julia 1.12.7;
JULIA_NUM_THREADS=4,JULIA_PKG_PRECOMPILE_AUTO=0,JULIA_NUM_PRECOMPILE_TASKS=1, and a workspaceTMPDIR. These full groups used each package's existing runner:Actual runner excerpts follow. PDIRK Core passed all 2,329 assertions. Broken assertions shown below were already present; this commit adds none.
PDIRK Core
PDIRK QA
NonlinearSolve Core (exit 1)
NonlinearSolve QA
Feagin QA
TaylorSeries QA
NonlinearSolve Core passed its 27 developer API assertions, then stopped at the default-branch failure:
Formatting, spelling over all changed files, and the staged diff check all exited 0 with no diagnostic output:
The docs build used the local Core 4.20.0, NonlinearSolve 2.10.0 and PDIRK 2.6.0 packages and exited 0:
Earlier CI failures and default controls
newton_tests.jlon cleanb94e13a3d2reproduces it on Julia 1.10.12, with--compiled-modules=no. The PR's Julia 1.12.7 Core run reports 4 Newton passes and 1 error at the same solve. Later Core testsets are not covered.b94e13a3d2, Julia 1.11.9, reproduces the exact assertion below: 38 passed, 1 failed across the two stats testsets. Key CI dependencies were pinned to NonlinearSolve 4.25.0, NonlinearSolveBase 2.45.0, SciMLBase 3.53.0 and SimpleNonlinearSolve 2.11.1, with local default Core/Differentiation/NonlinearSolve/SDIRK/BDF. Not every transitive dependency was pinned. The default CI downgrade pass uses a different resolution.AssertionError: mi2 !== nothingatensembles.jl:19.282f4851c8. Both QA runners pass locally at this head, including their allocation/JET/Aqua checks as reported above.No source changes were made for the reproduced default failures. GPU, downstream suites, performance benchmarks, PR suites on other Julia versions, and NonlinearSolve Core testsets after the error were not verified. New CI is not claimed green or awaited.
Next counted review must come from a model that authored no commit in this PR (risk.md § Independent reviews).
Links
Risk assessment
🤖 Posted by an AI agent — harness: Codex CLI · model: gpt-6.1-sol
Conversation: local fixer job SciML__OrdinaryDiffEq.jl__4465 (no session URL)
Risk assessment (independent review, Codex gpt-6.1-sol, head 97befc6)
MethodErrorfor positional-onlybuild_nlsolverfactories, and the new test expects it; (2) the branch conflicts with master and lacks master's threading-option fix (alg.threading ? …fails withSequential()/BaseThreads()); (3) the serial statistics on the issue's 50-state reproducer drift by one nf/nsolve/nnonliniter against master.🤖 Posted by an AI agent — harness: Codex CLI 0.163.0 (review) · model: gpt-6.1-sol; posted by Claude Code 2.1.302 · model: claude-opus-5-5 for the fleet master
Conversation: local session 01a14e8b-9083-7db3-8a45-c7fdfcef3450 (no session URL); master session https://claude.ai/code/session_0133iSjsLBByPU93BDEQkNDF
Fix by Codex gpt-6.1-sol (head 446d69d)
Merged master into the shared branch with a normal merge commit, preserving both histories. Master's
isthreaded(alg.threading)handling, Polyester test dependency, and threading-option tests are retained; the option test file is byte-identical to master.stats_deltareceives the keyword; otherwise the returned solver receives a typed buffered cache. No exception is caught or suppressed. The external-client test now asserts successful solves, analytic accuracy, and every statistics field for both mutation forms, serial/threaded PDIRK, and the non-PDIRK TRBDF2 caller.(nf, nsolve, nw, njacs, nnonliniter) = (41603, 1603, 800, 800, 1603), and an independent physical RHS-call count, for bothfalseandSequential().true,BaseThreads(), andPolyesterThreads(); solution, counter, failure-path, and private-buffer assertions remain. The always-new test also compares solutions.u(t) = 1/(1+t). The PR's existing Jacobian-state implementation prevents the out-of-place state aliasing exposed by this test.Only test dependencies were added: OrdinaryDiffEqSDIRK and the Serialization standard library are MIT-licensed. No runtime dependency was added. The PDIRK concurrency guidance describes the one-cache serial and two-cache threaded schedules.
Failing before / passing after
Julia 1.12.7, four threads. The same three regression files were included against an isolated original head
97befc690c, before the production edits. Their actual output was:The focused post-fix run passed all 221 assertions. The official final PDIRK Core and QA runs each include these results:
The identical serial regression independently passes 10/10 on clean master
b94e13a3d2, including the physical RHS-call count. The serial drift is removed by restoring its work schedule, without adjusting reported counters.The additional always-new regression was run with the same test file against clean master and the PR head:
Here and below
julia_cmddenotes the juliaup launcher; the two environment variables identify the isolated environments with their respective local sibling packages.Final local validation
All runs used a workspace
TMPDIR,JULIA_NUM_THREADS=4,JULIA_PKG_PRECOMPILE_AUTO=0, andJULIA_NUM_PRECOMPILE_TASKS=1. Full groups used the existing package runners:PDIRK Core: exit 0, 4,488 assertions passed. Actual tail:
PDIRK QA: exit 0. It also reruns the complete Core tests. Actual QA tail (the broken allocation assertion is pre-existing):
NonlinearSolve QA: exit 0. Existing broken assertions are unchanged:
NonlinearSolve Core: exit 1 at the independently confirmed default-branch failure. Actual output:
Runic and typos exited 0 without diagnostics;
git diff --cached --checkexited 0. These commands cover all Julia files changed by this follow-up, plus spelling in the changed project and guidance files:The full docs build used the local sibling packages and exited 0:
Documenter also emitted HTML/search-index size warnings. Added comment lines are 1/286 (0.3%). No assertion was disabled, skipped, or loosened.
Default-branch controls and limits
LineSearchExceptioninnewton_tests.jl:14, also present in default CI. A separate investigator verified the adjacent Core commits with identical sibling/dependency versions:61f52b3be9passes 6/6 Newton assertions;498c765cccgives 4 passes and 1 error. Removing only that commit's six-line timestep-rounding hunk from a scratch master Core copy restores success. No production change was made for this failure; the existing report is linked below.1.2823529411764707 <= 1.2619521912350598, with 38 passes and 1 failure. Latest default downgrade CI passes with its different dependency resolution. The pinned baseline control establishes that the historical failure is not introduced by this PR.AssertionError: mi2 !== nothing. This was checked from failed-step logs; the downstream suite was not run locally.Next counted review must come from a model that authored no commit in this PR (risk.md § Independent reviews).
Links
Risk assessment
🤖 Posted by an AI agent — harness: Codex CLI · model: gpt-6.1-sol
Conversation: local fixer job SciML__OrdinaryDiffEq.jl__4465 (no session URL)
Risk assessment (independent review, Codex CLI 0.164.0-alpha.11.1 gpt-6-astra, slot 1, head 446d69d)
Review round 1, written by the reviewer named above (Codex CLI 0.164.0-alpha.11.1 / gpt-6-astra) in a session other than the PR author's, and copied here by the posting agent without change to its findings. The posting agent did not re-run the reviewer's commands.
Summary: The PR buffers threaded nonlinear-solver counters and keeps always-new Newton state private, with substantial concurrency and analytic regression tests. The changed statistics path still has a failing minimum-dependency assertion whose claimed default-branch reproduction was not independently verified.
Blast radius: Core statistics routing, Differentiation Jacobian/linear-solve accounting, nonlinear-solver caches and always-new Newton state, and PDIRK threaded stage execution; ordinary implicit solvers consume the shared routing.
Evidence: PDIRK Core/QA/downgrade and many neighboring solver lanes pass; explicit four-thread tests and analytic solution checks satisfy G3/G1. New always-new Newton tests pass 5/5 in the failed NonlinearSolve runs. Two Core failures and the Enzyme integration failure match inspected default logs, but the separate downgrade statistics assertion does not have an independently verified matching baseline.
Blocking findings
lib/OrdinaryDiffEqNonlinearSolve/src/nlsolve.jl:369andlib/OrdinaryDiffEqNonlinearSolve/test/nsa_stats_tests.jl:91— confirmed by running (PR CI failure); PR causation suspected from reading, needs-verification: the minimum-version job fails the residual-work contractexcess[2] <= excess[1] + 0.25, evaluating1.2823529411764707 <= 1.2619521912350598; the stats suite ends with 38 passes and 1 failure. This PR changes the accounting used by that expression. The author reports the same failure on a manually pinned clean default branch, but the inspected default downgrade workflow passes and that separate local reproduction is not independent evidence. Run this test on the exact default and PR heads with the same resolved dependency stack (the reported control uses NonlinearSolve 4.25.0, NonlinearSolveBase 2.45.0, SciMLBase 3.53.0 and SimpleNonlinearSolve 2.11.1). If only the PR fails, correct the routing/counting regression; if both fail identically, supply those logs and track the upstream contract failure. Preserve the assertion rather than relaxing it.Non-blocking findings
lib/OrdinaryDiffEqCore/src/integrators/integrator_interface.jl:729: the statement that cache introspection adds “no added work” is an optimization claim. The concrete representation is small (six counters per buffered solver), but this review did not measure serial-path compilation or runtime cost; qualify the claim or retain a representative benchmark.What I ran
git rev-parse HEADreturned446d69dac0afe35ae53c52b0c6b71dff76f14f38; exact detached PR head verified (exit 0).git diff origin/master...HEADandgit diff --check origin/master...HEADcompleted (exit 0); changed files, tests, callers, and repository instructions inspected. RootAGENTS.mdandCLAUDE.mdare absent. Risk was frozen before opening the description.git rev-parse origin/masterreturned14b964b315e1310b5e3621a1bcfe6b92e9e506aa; GitHub's PR metadata base isb94e13a3d2f59e6f7e1d4a38e29fe2c75b4b09d5. The review diff uses the three-dot merge base; the header records the fetched base-branch tip.git log -1 --first-parent --no-merges --format=%Binspected (exit 0); author trailers recorded below, orunknownwhen absent.gh pr view 4465 --repo SciML/OrdinaryDiffEq.jl --json number,url,state,isDraft,headRefOid,baseRefName,baseRefOid,title,files,statusCheckRollupand the subsequent PR body read succeeded. Live state was OPEN.gh pr checks 4465 --repo SciML/OrdinaryDiffEq.jldata: 268 success, 4 failure, 1 skipped. PDIRK Core (current/LTS/prerelease), QA and downgrade all pass. The Core runner invokesthreaded_stats_tests.jlon at least four threads, spawning a four-thread child when necessary, and the test rejects fewer than four; it is not silently skipped. PDIRK Core.gh run view 39130337902 --repo SciML/OrdinaryDiffEq.jl --log-failed(retrieval exit 0): both current and LTS NonlinearSolve Core jobs passAlways-new Newton State | 5 5, then failnewton_tests.jl:14withLineSearchException: Search direction is not a direction of descent. Step length: 0.0; Newton summary 4 passes, 1 error. PR Core.gh run view 41058796614 --repo SciML/OrdinaryDiffEq.jl --log-failed(retrieval exit 0) confirms the same default-branch Newton file/line, exception and 4-pass/1-error result. This supports baseline classification of the Newton exception, not of other red checks. Default Sublibrary CI.gh run view 39130337779 --repo SciML/OrdinaryDiffEq.jl --log-failed(retrieval exit 0): Julia 1.11.9;Always-new Newton State | 5 5,Newton Tests | 6 6, then the distinct stats assertion in the blocker; process exit 1. Recent default downgrade run41058798190reports success. PR downgrade, default downgrade.gh run view 39130337760 --repo SciML/OrdinaryDiffEq.jl --log-failedand the same command for recent default IntegrationTest run41050161729(retrieval exit 0) show the identicalEnsembleThreadsfailure atdownstream/test/Core4/ensembles.jl:19:AssertionError: mi2 !== nothingfrom Enzymethreadsfor_commoninparallelrules.jl:233. PR integration, default integration.What I did not verify
No local reviewer Julia, race stress test, or performance benchmark was run. The author-reported same-dependency default reproduction of the stats assertion and failing-before race demonstration were not independently rerun. Tests after the Newton exception in the failed Core jobs are not all verified by those jobs. The full resolved minimum-version manifest comparison remains the blocking verification task.
🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5
Conversation: https://claude.ai/code/session_01379heiiB35TtywhR7uSU74
Fix by Codex CLI 0.164.0 gpt-6.1-sol (head 446d69d)
Verification only: both requested failing checks are pre-existing. No production file, test, dependency constraint, or branch history was changed; no new commit or push was made. The assertion remains intact.
Matched dependency reproduction of the statistics blocker
Independently ran the complete, unmodified
nsa_stats_tests.jlon PR head446d69dac0afe35ae53c52b0c6b71dff76f14f38and clean current default4460ff80dad621418e6e3a9b63e4afb2e1f5fc02. Each environment develops that head's Core, Differentiation, NonlinearSolve, and DiffEqBase sources. All 188/188 registry and standard-library versions printed in the failing CI test manifest match; all 189 non-path manifest records, including tree hashes, are identical between the two local environments. The official test files are byte-identical.Key versions: Julia 1.11.9, NonlinearSolve 4.25.0, NonlinearSolveBase 2.45.0, SimpleNonlinearSolve 2.11.1, SciMLBase 3.53.0, SDIRK 2.9.0, BDF 2.2.1, LinearSolve 5.15.0. Canonical external-manifest SHA256:
b4361dc24e314f58ab3b9fcf1e29d45d74dc103c37a526dee30d4ff01c835716.Commands used the juliaup launcher (
J), isolated environments (PR_ENV/BASE_ENV), source directories (PR_SOURCE/BASE_SOURCE), and a provenance-printing runner (STATS_RUNNER) that includes the unchanged official file inside@testset "Unmodified official statistics regression". All runs use workspace temporary storage,JULIA_NUM_THREADS=4,JULIA_PKG_PRECOMPILE_AUTO=0, andJULIA_NUM_PRECOMPILE_TASKS=1.Both commands exited 1 with exactly the CI assertion:
PR output:
Default output:
The latest green default downgrade job uses registered Core 4.14.0 / Differentiation 3.10.0 / SciMLBase 3.46.0. Its 39/39 result therefore does not contradict the controlled current-source reproduction above. This directly supplies the missing two-head, same-dependency evidence requested by the independent reviewer.
A separate baseline investigation reduced the failure to QNDF on the official two-state linear problem. On clean current master, the excess work is
(1.0119521912350598, 1.2823529411764707). An otherwise identical scratch control removing only the six timestep-rounding lines introduced by Core commit498c765ccc07522b48e6cb8df0567e734c0a46c1passes the unchanged three-assertion reproducer. All external manifest entries are identical. This is an additional effect of the existing timestep-rounding regression, rather than evidence of a new statistics-sink defect. The historical residual-optimization commit passes the reduced test; its parent fails, so that boundary is an improvement and is not presented as the introduction of this failure.Enzyme downstream failure
Historical default push CI has the exact same
threadsfor_common/AssertionError: mi2 !== nothingas the PR. A separate baseline investigator reproduced it locally using only Enzyme, Test, and InteractiveUtils: a threaded sum-of-squares gradient on Julia 1.13.3 / Enzyme 0.13.216 exits 1 with that assertion.Applying only the production-file patch from the merged Enzyme fix, with identical external manifest entries, makes the same reproducer exit 0:
Current default Core4 CI passes with Enzyme 0.13.219, which contains that upstream fix. No OrdinaryDiffEq source merge is needed for this external dependency correction.
Verification limits and review
No Runic, typos, QA, complete Core group, docs build, GPU, performance benchmark, or full downstream suite was rerun in this verification-only follow-up. No code commit is returned, and no CI rerun was requested. The overall PR's previous high-risk assessment remains; this session supplies failure classification evidence rather than a counted independent review or a green-CI claim.
Next counted review must come from a smart model in a fresh session, not this fix session (risk.md § Independent reviews).
Links
QNDF baseline reproducer and controlled rounding isolation: Newton BackTracking test fails on master since 498c765ccc (calc_dt_propose! dt rounding) #4681 (comment)
Core rounding commit: 498c765
PR head tested: ChrisRackauckas-Claude@446d69d
Default head tested: 4460ff8
Historical optimization: 7573f2f
PR and independent review: Reduce PDIRK statistics after worker joins without a global lock #4465
Failing PR downgrade job: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/39130337779/job/117684060348
Latest default downgrade job: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/42569947060/job/129004798175
Historical default Core4 failure: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/41050161729/job/124043940811
Latest default Core4 pass: https://github.com/SciML/OrdinaryDiffEq.jl/actions/runs/42569947107/job/129004768473
Existing upstream Enzyme fix: Fix CI on Julia 1.11 and the Julia 1.13 branch EnzymeAD/Enzyme.jl#3819
Isolated upstream fix commit: EnzymeAD/Enzyme.jl@4916314
🤖 Posted by an AI agent — harness: Codex CLI 0.164.0 · model: gpt-6.1-sol
Conversation: local fixer job SciML__OrdinaryDiffEq.jl__4465 (no session URL)
Fix by Muse CLI Code muse-wonder-full-1.0 (head aa0387b)
Merged the current default branch (
6343f5a0b7, 45 commits) into this branch; the branch wasCONFLICTINGbefore the merge and the default branch is now an ancestor of the head. Conflict resolution, inlib/OrdinaryDiffEqDifferentiation,lib/OrdinaryDiffEqNonlinearSolve,lib/OrdinaryDiffEqCore, andlib/OrdinaryDiffEqPDIRK:_calc_J!/_jacobian!/_calc_W!member-algorithm dispatch with this PR'sstats_sinkandnext_uplumbing:_calc_J!and_calc_W!takenext_u, and_jacobian!takes and forwardsstats_sink. The auto-merge had left_jacobian!and_dolinsolvereferencing astats_sinkthey never received.dolinsolve's newalgkeyword with this PR'sstats_sinkkeyword, threading the sink into_dolinsolve/drain_jvp_count!.always_newNewton, kept this PR's privatenext_u(no write to the sharedintegrator.u) and computed it with the default branch's_stage_of_z/_stage_of_z!into the solver cache'sustep, so the Jacobian is evaluated at the stage value for DAE, coefficient-multistep, and DIRK formulations alike.OrdinaryDiffEqCore4.21.0 (default branch: 4.20.1) andOrdinaryDiffEqDifferentiation3.14.0 (default branch: 3.13.0), with matching compat floors inOrdinaryDiffEqNonlinearSolve(2.10.0) andOrdinaryDiffEqPDIRK(2.6.0). Test runners keep both branches' testsets.Failing checks on the previous head, classified with
rack ci compare --no-record https://github.com/SciML/OrdinaryDiffEq.jl/pull/4465before the merge:OrdinaryDiffEqNonlinearSolveCore (Julia 1 and LTS): pre-existing. The newest default-branch runs fail with the same step and the same signatures (SafeTestsets.jl:30,LoadError: LineSearchException: Search direction is not a direction of descent. Step length: 0.0). The merged tree reproduces exactly that failure locally (below); no code was changed for it.OrdinaryDiffEqNonlinearSolve: the one failure isnsa_stats_tests.jl:91(1.2823529411764707 <= 1.2619521912350598) under downgraded dependencies. On the merged tree with current dependencies that file passes in full (below). A prior investigation on this PR reproduced the exact assertion on a clean default branch with the downgrade job's dependency versions.AssertionError: mi2 !== nothing, previously also observed on the default branch. Not re-run locally (downstream Enzyme suite); the merge brings in the current default branch either way.Validation on the merged tree (Julia 1.12.4, 4 threads). Exact commands and observed output tails:
Not verified: the full-group
OrdinaryDiffEqPDIRKQA run (its runner repeats the Core testsets before JET/Aqua), the downgrade resolution on Julia 1.11, the SciMLSensitivity Core4 downstream suite, Julia LTS, and the docs build (no docstring or public API changes in this merge beyond version numbers).Next counted review must come from a smart model in a fresh session, not this fix session (risk.md § Independent reviews).
🤖 Posted by an AI agent — harness: Muse CLI Code · model: muse-wonder-full-1.0
Conversation: local fixer job SciML__OrdinaryDiffEq.jl__4465 (no session URL)
Fix by Codex CLI 0.170.0 gpt-6.2-sol (head ed93a92)
Each affected QA project declares the local OrdinaryDiffEqCore source once. This repairs QA activation for IMEXMultistep, PDIRK, TaylorSeries, Extrapolation, and Feagin. The
stats_sinkdocstring now describes its return value without an unmeasured performance claim.Failing before and passing after
The same scratch test parsed the five QA projects with Julia's TOML parser and verified that each source resolves to the local Core.
Local validation
Julia 1.13.3 and four threads. The package runner command was:
Each run ended with
Testing OrdinaryDiffEq<Sub> tests passed.Runic, typos, whitespace validation, and docs exited 0. Documenter reported HTML and search-index size warnings and skipped deployment outside CI.
NonlinearSolve downgrade baseline
The official statistics test on clean default
ace83e0140and PRaa0387b1bbexited 1 on Julia 1.11.9 with identical results. The run environments match all 188 external versions printed in the failing CI job and have identical 189 external manifest records.A separate QNDF control on clean default failed 2/3, then passed 3/3 after reversing only the timestep-rounding hunk in scratch. The green default downgrade job selects Core 4.14.0, Differentiation 3.10.0, and SciMLBase 3.46.0. Failing PR job, green default job, tracked QNDF investigation.
Next counted review must come from a smart model in a fresh session, not this fix session.
🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6.2-sol
Conversation: local session 01a201c3-092f-7d73-8636-6f243e9ecf35 (no session URL)