Skip to content

Differentiate with a fitting chunk after resize!/deleteat! shrinks the state below the ForwardDiff chunk - #4804

Draft
ChrisRackauckas-Claude wants to merge 7 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/resize-jac-config-chunk
Draft

ChrisRackauckas-Claude wants to merge 7 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/resize-jac-config-chunk

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Please ignore until reviewed by @ChrisRackauckas.

A prepared ForwardDiff Jacobian config keeps the chunk chosen at init, because the chunk is a type parameter of the config and of the solver cache. resize_jac_config! → DI.prepare!_jacobian only resizes its dual buffers, so after resize!/deleteat! shrinks the state below that chunk, ForwardDiff throws chunk size cannot be greater than structural_length. Since a smaller-chunk config cannot be stored in the typed cache, jacobian! now detects that case (shrunk_forwarddiff_backend) and differentiates without the prepared config, through the unwrapped RHS, with a chunk that fits. Nothing changes while the stored chunk fits; the check is two integer comparisons per Jacobian.

Chunk handling:

  • An explicit AutoForwardDiff(chunksize = k) is used unchanged while k ≤ length(u). When k > length(u) it is clamped to length(u).
  • The automatic chunk (pickchunksize(length(u0))) is replaced by DI's automatic pick for the new length when it no longer fits.
  • The RHS is unwrapped (SciMLBase.unwrapped_f) in the fallback, because an AutoSpecialize wrapper only accepts duals of the init chunk.

resize_grad_config! is unaffected: the time derivative always uses one partial. The change is confined to derivative_wrappers.jl, so it does not overlap with #4796 (integrator_interface.jl).

Verification

Regression test lib/OrdinaryDiffEqDifferentiation/test/resize_chunksize_tests.jl (added to the Core group): a 10-state system is stepped to t = 0.5, shrunk to 2 states, and solved to t = 1. The result is compared with a fresh solve of the 2-state system from the same state. The cases are Rodas5P (resize! and deleteat!), Rodas5P with chunksize = 5 (clamped), TRBDF2, KenCarp4, and TRBDF2 with chunksize = 2 (respected), each with FullSpecialize and AutoSpecialize. The tolerance is rtol = 1e-5. TRBDF2's own error against exp(A t) at reltol = 1e-10 is 3.4e-6 on the fresh solve and 2.1e-6 on the continued solve. The continued solve with AutoFiniteDiff gives the identical value, so the gap is TRBDF2's accuracy, not the Jacobian.

$ julia --project=env -e 'using Test; @testset "all" begin include("repo/lib/OrdinaryDiffEqDifferentiation/test/resize_chunksize_tests.jl") end'

On master (cceca42, fix reverted): 8 errors, all ArgumentError: chunk size cannot be greater than ForwardDiff.structural_length(x)

Test Summary:                                       | Pass  Error  Total     Time
all                                                 |   18      8     26  5m20.3s
  Rodas5P SciMLBase.FullSpecialize resize_shrink!   |           1      1    10.2s
  Rodas5P SciMLBase.AutoSpecialize resize_shrink!   |    3             3     7.2s
  Rodas5P SciMLBase.FullSpecialize deleteat_shrink! |           1      1     0.5s
  Rodas5P SciMLBase.AutoSpecialize deleteat_shrink! |    3             3     0.1s
  Rodas5P SciMLBase.FullSpecialize resize_shrink!   |           1      1     7.7s
  Rodas5P SciMLBase.AutoSpecialize resize_shrink!   |           1      1     7.8s
  Rodas5P SciMLBase.FullSpecialize deleteat_shrink! |           1      1     0.4s
  Rodas5P SciMLBase.AutoSpecialize deleteat_shrink! |           1      1     0.9s
  TRBDF2 SciMLBase.FullSpecialize resize_shrink!    |           1      1    17.1s
  TRBDF2 SciMLBase.AutoSpecialize resize_shrink!    |    3             3    14.9s
  KenCarp4 SciMLBase.FullSpecialize resize_shrink!  |           1      1    18.4s
  KenCarp4 SciMLBase.AutoSpecialize resize_shrink!  |    3             3    13.7s
  TRBDF2 SciMLBase.FullSpecialize resize_shrink!    |    3             3    27.6s
  TRBDF2 SciMLBase.AutoSpecialize resize_shrink!    |    3             3    28.2s

With the fix:

Test Summary: | Pass  Total     Time
all           |   42     42  3m16.7s

The reproducer from #4803 prints Success for all six cases with the fix (6 lines, 4 of them ERROR on master).

Existing tests, run with the fix, one file per process:

autodiff_error_tests.jl          4/4
differentiation_traits_tests.jl  5/5
wrapped_dae_chunksize_tests.jl  13/13
nf_accounting_tests.jl          33/33
test/Integrators_II/resize_tests.jl  90/90

Runic --check and typos on the touched files: exit 0.

Not verified

Fixes #4803

Risk assessment

  • Risk: low
  • Blast radius: OrdinaryDiffEqDifferentiation.jacobian! (in-place ForwardDiff Jacobians for every implicit/Rosenbrock method). When the stored chunk fits, which covers every non-resized solve, the only change is a call through _jacobian!, which forwards to the same DI.jacobian! call. No public API changes.
  • Evidence: the new test fails on master (8 errors) and passes with the fix (42/42), and the five existing related test files pass.
  • Independent review: pending
  • Merge: needs human review. The clamping of a user-set chunk is a behavior choice, and reading the auto chunk from integrator.sol.prob.u0 assumes the Jacobian config was prepared at the length of prob.u0.

🤖 Generated with Claude Code (model: claude-opus-5-5[1m])

https://claude.ai/code/session_01AXwyJDRaMKgnYMG9M1Ut49

Review findings addressed

Independent review: codex-cli 0.163.0 / gpt-6.1-sol rated the PR at head a2f84f9 medium risk, high confidence, verdict CHANGES, with one finding.

  1. [P2] The automatic chunk was inferred from mutable prob.u0. Fixed. With alias = ODEAliasSpecifier(alias_u0 = true), integrator.u is prob.u0, so shrinking the state also shrank prob.u0. The check then saw a chunk that fit and used the 10-partial prepared config on a 2-element state. Now build_jac_config records the chunk of a dense ForwardDiff config when it prepares it, as a third tuple element (nothing for other backends; the no-config value stays (nothing, nothing)). resize_jac_config! carries that element over, and jacobian! compares the state length against it. DifferentiationInterface has no public way to read a prep's chunk (overloaded_input_type is documented as experimental and not public), so the value is recorded instead. The fallback chunk is now length(u) for explicit and automatic chunks alike. For an automatic chunk this is also ForwardDiff's own pick, because an automatic chunk never exceeds ForwardDiff's chunk threshold. The regression test adds alias_u0 = true cases, each run with FullSpecialize and AutoSpecialize: Rodas5P with the automatic chunk (resize! and deleteat!), Rodas5P with chunksize = 5, and TRBDF2 with the automatic chunk.

Fail-before: the updated test file against head a2f84f9 has 3 errors, all ArgumentError: chunk size cannot be greater than ForwardDiff.structural_length(x) (10 > 2):

all                                                      |   57      3     60  1m02.4s
  Rodas5P FullSpecialize resize_shrink! alias_u0=true    |           1      1     0.6s
  Rodas5P FullSpecialize deleteat_shrink! alias_u0=true  |           1      1     0.1s
  TRBDF2 FullSpecialize resize_shrink! alias_u0=true     |           1      1     0.2s

Pass-after:

all           |   66     66  1m44.4s

With the fix, the reviewer's aliasing probe (Rodas5P auto and chunksize = 5, TRBDF2 auto, alias_u0 false and true) prints Success on all six lines. Before the fix, two of them errored.

API note. build_jac_config and jacobian! are declared public developer API. The tuple returned for a prepared config gains a third element. Indexing [1] and [2] and two-element destructuring behave as before. jacobian! still accepts a two-element jac_config; in that case it uses the prepared config, as on master. The automatic-chunk record is ForwardDiff.pickchunksize(length(u)), which assumes DI prepares AutoForwardDiff() with ForwardDiff.Chunk(u) (true for DI 0.7.21). A reviewer may prefer preparing with that explicit chunk instead, so the record is authoritative by construction.

Validation (Julia 1.13.2, 4 threads), run on the final tree:

  • GROUP=Core for OrdinaryDiffEqDifferentiation (Pkg.test()): all 18 testsets pass, including Resize below ForwardDiff chunk | 66 66.
  • GROUP=QA: JET 1/1, Aqua 19/19, JVPCache allocation 13 pass and 2 broken, from an existing broken = true test in that file.
  • Root GROUP=Integrators_II (Pkg.test() of the monorepo root): passes. Resize Tests 90/90 and deleteat!/addat! Tests 48/48; Cache Tests 214 pass and 4 broken, IMEX Split 15 pass and 1 broken, all from existing @test_broken in files this PR does not touch.
  • Runic --check and typos on the changed files: exit 0.

Not verified: Julia lts/pre, GPU, DelayDiffEq resize (it calls the same resize_jac_config!), and FIRK/exponential caches after a shrink.


🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5
Conversation: local session ID 09d44832-9166-4fc4-9b9f-0d9e1ea97b2c (headless, no URL)

Breaking change

OrdinaryDiffEqDifferentiation.build_jac_config is declared public (Julia ≥ 1.11) and is documented in the Developer Extension API. In this PR, for every backend that gets a prepared config, it returns (config, config, chunksize) instead of (config, config). chunksize is an Int for a dense CPU AutoForwardDiff config and nothing for every other backend. The no-config value (nothing, nothing) is unchanged. Code that dispatches on Tuple{Any, Any}, checks length(jac_config) == 2, or iterates over the configs sees a third element. For caches built with such a config, resize_jac_config! returns the three-element tuple too.

This requires a major release of OrdinaryDiffEqDifferentiation: 3.12.4 → 4.0.0. This PR does not bump the version. At release, every package whose compat on OrdinaryDiffEqDifferentiation is "3.x" has to widen it to include 4: OrdinaryDiffEqBDF, OrdinaryDiffEqExponentialRK, DelayDiffEq, OrdinaryDiffEqRosenbrock, OrdinaryDiffEqIMEXMultistep, OrdinaryDiffEqExtrapolation, OrdinaryDiffEqNonlinearSolve, OrdinaryDiffEqMultirateImplicit, OrdinaryDiffEqFIRK, OrdinaryDiffEqSDC, OrdinaryDiffEqSDIRK, OrdinaryDiffEqPDIRK, OrdinaryDiffEqStabilizedIRK and StochasticDiffEqImplicit. OrdinaryDiffEqTaylorSeriesImplicit, StochasticDiffEq and the OrdinaryDiffEq root also depend on it and need the same check. The "API note" in the first review-findings section above calls the change additive. That is wrong: as the second review shows, a method on Tuple{Any, Any} no longer matches.

Review findings addressed (round 2)

Re-review by codex-cli 0.163.0 / gpt-6.1-sol at head 4cbf4f7: medium risk, high confidence, verdict CHANGES, one finding. The reviewer also re-ran the regression independently: 57 passes and 3 errors before the fix, 66/66 after.

  1. [P2] Preserve the public two-config return contract, or version this as breaking. No code change. The required major bump is stated above. Whether to ship it that way or to switch to the non-breaking design below is for @ChrisRackauckas to decide. Reasons the pair is not kept in this PR:
    • jacobian! needs the prepared chunk after a resize, and the only object that both build_jac_config and jacobian! see is the returned tuple. DifferentiationInterface has no public query for a prep's chunk: overloaded_input_type is documented as "experimental and not part of the public API", and reading the prep's fields would rely on DI internals.
    • Resolving the automatic chunk in prepare_alg would make it stable, but it changes integrator.alg and sol.alg for every ForwardDiff solve. DAE initialization also passes alg_autodiff(integrator.alg) to the NewtonRaphson of its own nonlinear solve.
    • Non-breaking alternative: keep build_jac_config returning the pair, add a separate public builder that appends the chunk, and use it only in the caches that call resize_jac_config!: the mutable Rosenbrock caches and the NLNewton/NonlinearSolveAlg nlsolver caches. OrdinaryDiffEqDifferentiation would then need only a minor bump. The catch is that OrdinaryDiffEqNonlinearSolve has no [sources] entry for OrdinaryDiffEqDifferentiation, so its sublibrary CI would resolve the registered 3.12.4 and fail to load until a Differentiation release. It would have to land as two stacked PRs: first OrdinaryDiffEqDifferentiation (new builder, plus jacobian! reading the third element), then the Rosenbrock/NonlinearSolve callers with raised lower bounds and this regression test.

No code changed in this round, so no tests were re-run. The validation listed in the first review-findings section applies to head 4cbf4f7.


🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5
Conversation: local session ID 09d44832-9166-4fc4-9b9f-0d9e1ea97b2c (headless, no URL)

🤖 Automated review section from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

Fix by Codex CLI 0.164.0 gpt-6.1-sol (head 4101acf)

build_jac_config preserves its public two-preparation tuple. The documented public build_resize_jac_config records the chunk for the mutable Rosenbrock and nonlinear-solver caches. Differentiation is versioned 3.13.0, its callers require 3.13, and NonlinearSolve has a local Differentiation source entry. The earlier Breaking change section describes the original reviewed head; this head uses the compatible builder design.

The regression checks both solver results against exp([-1 0.25; 0.25 -2] * 0.5) * u_mid. It retains resize/delete, specialization, aliasing, and explicit/automatic chunk cases. The step cap is 1e-4, with an analytic relative-error budget of 1e-7: the second-order scale T * norm(A, Inf)^3 * dtmax^2 is approximately 5.7e-8 before the method's error coefficient. Manual resizing flags the dimension-dependent RHS discontinuity through derivative_discontinuity!. The existing solver-to-solver tolerance stays unchanged. The pair-contract checks cover automatic ForwardDiff, explicit chunk 5, and finite differences; NonlinearSolve's public-API QA checks the new import without an ignore entry.

Failing before / passing after

The same final test file ran with matching external dependencies and archived library sources. $PR_HEAD_ENV denotes the archived original head, and $MERGE_BASE_ENV denotes merge-base 59ba40e; only the in-repository source paths in the saved test Manifest were remapped.

julia +1.13.3 --compiled-modules=existing --project="$PR_HEAD_ENV" -e 'using Test; @testset "Resize and public contract" begin include("lib/OrdinaryDiffEqDifferentiation/test/resize_chunksize_tests.jl") end'
julia +1.13.3 --compiled-modules=existing --project="$MERGE_BASE_ENV" -e 'using Test; @testset "Resize and public contract" begin include("lib/OrdinaryDiffEqDifferentiation/test/resize_chunksize_tests.jl") end'

Original reviewed head: exit 1, six pair-contract assertion failures; every analytic check passes.

Resize and public contract                                         |  119     6    125  2m46.3s

Merge-base: exit 1, thirteen ArgumentError: chunk size cannot be greater than ForwardDiff.structural_length(x) errors. The manual discontinuity notification preserves the original bug coverage.

Resize and public contract                                         |   60     13     73  2m20.3s

Fixed tree, official Core group: exit 0, all 18 testsets pass.

Resize below ForwardDiff chunk |  125    125  2m15.8s
Testing OrdinaryDiffEqDifferentiation tests passed

Local validation

Julia 1.13.3 through juliaup, JULIA_NUM_THREADS=4, OPENBLAS_NUM_THREADS=1, JULIA_NUM_PRECOMPILE_TASKS=1, and JULIA_PKG_PRECOMPILE_AUTO=0. Package test children used existing compiled modules to limit subprocesses.

GROUP=Core julia +1.13.3 --project=lib/OrdinaryDiffEqDifferentiation -e 'using Pkg; Pkg.resolve(); Pkg.test(; julia_args = ["--compiled-modules=existing"])'
for project in lib/OrdinaryDiffEqDifferentiation lib/OrdinaryDiffEqRosenbrock lib/OrdinaryDiffEqNonlinearSolve; do
    GROUP=QA julia +1.13.3 --project="$project" -e 'using Pkg; Pkg.instantiate(); Pkg.test(; julia_args = ["--compiled-modules=existing"])'
done
GROUP=QA julia +1.13.3 --project=lib/OrdinaryDiffEqNonlinearSolve -e 'using Pkg; Pkg.test(; julia_args = ["--compiled-modules=existing"])'
GROUP=Integrators_II julia +1.13.3 --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.test(; julia_args = ["--compiled-modules=existing"])'
GROUP=QA julia +1.13.3 --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.test(; julia_args = ["--compiled-modules=existing"])'

The three library QA groups exit 0. Their summary rows, in the order above (the NonlinearSolve rows are from the final run without the new-builder ignore):

differentiation-qa
Test Summary: | Pass  Total  Time
JET Tests     |    1      1  4.7s
Test Summary: | Pass  Total   Time
Aqua          |   19     19  27.2s
Test Summary:       | Pass  Broken  Total   Time
JVPCache allocation |   13       2     15  14.3s
rosenbrock-qa
Test Summary:    | Broken  Total     Time
Allocation Tests |     20     20  2m47.5s
Test Summary:   | Pass  Total     Time
Inference Tests |   40     40  2m25.4s
Test Summary: | Pass  Total  Time
JET Tests     |    1      1  1.2s
Test Summary: | Pass  Total     Time
Aqua          |   21     21  1m09.8s
nonlinear-qa-public
Test Summary: | Pass  Broken  Total   Time
JET Tests     |   13      33     46  36.2s
Test Summary: | Pass  Total   Time
Aqua          |   41     41  30.0s

These runs report broken allocation/JET assertions from the existing suites; those assertions remain unverified. No skip, broken marker, tolerance relaxation, or error suppression was added.

Root Integrators_II exits 0:

Integrator RNG Tests |   41     41  1m06.2s
Reverse Directioned Event Tests |  170    170  5m45.1s
Differentiation Direction Tests |   12     12  26.3s
Resize Tests  |   90     90  1m29.2s
deleteat!/addat! Tests |   48     48  31.3s
Cache Tests   |  214       4    218  10m48.2s
Add Steps Tests |    1      1  3m58.9s
IMEX Split Function Tests |   15       1     16  2m58.5s
Testing OrdinaryDiffEq tests passed

Root QA exits 0:

Quality Assurance Tests |  111    111  51.2s
Testing OrdinaryDiffEq tests passed

Formatting and spelling commands ran before committing, all with exit 0:

julia +1.13.3 --project=@runic -m Runic --inplace $(git diff --name-only -- '*.jl')
typos $(git diff --name-only)
git diff --check

The full Runic pass left the Julia file hashes unchanged. After removing the redundant QA ignore, julia +1.13.3 --project=@runic -m Runic --inplace lib/OrdinaryDiffEqNonlinearSolve/test/qa/qa.jl, spelling, and git diff --check also exit 0.

Baseline failures and documentation

GROUP=Core julia +1.13.3 --project=lib/OrdinaryDiffEqNonlinearSolve -e 'using Pkg; Pkg.instantiate(); Pkg.test(; julia_args = ["--compiled-modules=existing"])' still exits 1:

Developer API Tests |   27     27
Newton Tests        |    4      1      5
LoadError: LineSearchException: Search direction is not a direction of descent. Step length: 0.0

The same exception reproduces with the official Core runner on clean upstream 6a6d63e642: Julia 1.13.3, NonlinearSolve 4.32.0, LineSearches 7.8.2, Core 4.19.1, Differentiation 3.12.5, SDIRK 2.9.8. The actual default push log also contains the exception. The existing open fix owns it; it is unmerged, so no upstream merge or duplicate issue was made here.

The historical PR Core4 job used Julia 1.13.2 and Enzyme 0.13.216. The latest actual default push Core4 job succeeds on Julia 1.13.3 with Enzyme 0.13.217. The retained Enzyme investigation was not duplicated, and Core4 was not rerun locally.

Fresh docs dependency resolution selected ChainRules 1.74.11 and failed loading TaylorDiff with TypeError: non-boolean (Symbolics.Num) used in boolean context. A standalone using TaylorDiff probe, with Julia 1.13.3 / TaylorDiff 0.3.5 / Symbolics 7.48.0 held fixed, fails with ChainRules 1.74.11 and succeeds with 1.74.10. The successful default docs push used 1.74.10. With that version pinned only in the local ignored Manifest, this strict docs command exits 0:

julia +1.13.3 --compiled-modules=existing --project=docs -e 'using Pkg; Pkg.pin(PackageSpec(name="ChainRules", uuid="082447d4-558c-5d27-93f4-14fc19e9eca2", version=v"1.74.10")); include("docs/make.jl")'
[ Info: Doctest: running doctests.
[ Info: CheckDocument: running document checks.
[ Info: Populate: populating indices.
[ Info: RenderDocument: rendering document.
[ Info: HTMLWriter: rendering HTML pages.

Not verified locally: LTS/prerelease Julia, GPU, Differentiation Sparse/ModelingToolkit groups, heavy downstream suites, or allocation/performance guarantees. New-head CI was checked once: test/docs workflows were queued or running; the ancillary Dependabot Auto-merge workflow reported startup_failure. CI completion is not claimed.

Risk assessment

  • Risk: medium — author assessment; a fresh independent rating is pending.
  • Blast radius: Differentiation's new public builder, Rosenbrock/nonlinear cache construction, and their Differentiation lower bounds. The legacy pair API is preserved. Dependent releases require Differentiation 3.13 to be published first.
  • Evidence: discriminating before/after results, full Differentiation Core, three library QA groups, root Integrators_II and QA, formatting/spelling, and docs with the verified default-CI ChainRules version.
  • Independent review: pending on this head. The prior high-risk CHANGES review covers the original head.
  • Merge: needs human review — public API addition and release coordination. No merge or approval was performed.

Links

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: Codex CLI 0.164.0 · model: gpt-6.1-sol
Conversation: local fixer job SciML__OrdinaryDiffEq.jl__4804 (no session URL)

🤖 Automated review section from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

Fix by Codex CLI 0.164.0 gpt-6.1-sol (head e65c8ed)

Merged current master normally. Its algorithm-dispatch _jacobian! and this PR's preparation-dispatch helper had identical seven-argument signatures in the CI merge. The preparation helper is named _resized_jacobian!, preserving algorithm dispatch and allowing module precompilation. A regression covers empty and two-state Rodas5P/TRBDF2 solves with ForwardDiff and finite differences against the analytic exponential.

Master now uses Differentiation 3.13.0, so this PR's new public builder is versioned 3.14.0 and both callers require 3.14. NonlinearSolve's local sources include Core and DiffEqBase as well as Differentiation, allowing its standalone project to resolve the required in-repository versions.

Failing before / passing after

The identical new regression file ran through the official Core runner before the helper rename:

GROUP=Core timeout 7200 julia +1.13.3 --project=lib/OrdinaryDiffEqDifferentiation -e 'using Pkg; Pkg.test(; julia_args = ["--compiled-modules=existing"])'

Exit 1:

Test Summary:                         | Error  Total     Time
Implicit Jacobian dispatch            |     8      8  1m01.2s

All eight cases error with MethodError: no method matching jacobian!(::...alg, ::...integrator, ...). The native docs build also exits 1 with ERROR: Method overwriting is not permitted during Module precompilation.

Fixed full Core group, exit 0:

Implicit Jacobian dispatch |   24     24  53.5s
Resize below ForwardDiff chunk |  125    125  2m24.7s
Testing OrdinaryDiffEqDifferentiation tests passed

Before the additional local source entries, the NonlinearSolve QA command below exits 1 during resolution: registered Core versions stop at 4.19.1, while local Differentiation requires Core 4.20. The same command resolves and passes after those entries are added.

Local validation

Julia 1.13.3, JULIA_NUM_THREADS=4, OPENBLAS_NUM_THREADS=1, JULIA_NUM_PRECOMPILE_TASKS=1, JULIA_PKG_PRECOMPILE_AUTO=0, and a job-local temporary directory. Test children use existing compiled modules to bound process counts.

Commands executed for the full groups:

GROUP=Core timeout 10800 julia +1.13.3 --project=lib/OrdinaryDiffEqDifferentiation -e 'using Pkg; Pkg.resolve(); Pkg.test(; julia_args = ["--compiled-modules=existing"])'
GROUP=InterfaceI timeout 10800 julia +1.13.3 --project=. -e 'using Pkg; Pkg.resolve(); Pkg.test(; julia_args = ["--compiled-modules=existing"])'
for project in lib/OrdinaryDiffEqDifferentiation . lib/OrdinaryDiffEqRosenbrock lib/OrdinaryDiffEqNonlinearSolve; do
    GROUP=QA timeout 10800 julia +1.13.3 --project="$project" -e 'using Pkg; Pkg.resolve(); Pkg.test(; julia_args = ["--compiled-modules=existing"])'
done

All final runs exit 0. Selected actual summary rows:

Differentiation QA:
JET Tests     |    1      1  11.5s
Aqua          |   19     19  21.9s
JVPCache allocation |   13       2     15  14.3s
Root QA:
Quality Assurance Tests |  111    111  27.0s
Root InterfaceI:
Null u0 Callbacks Tests |   42     42  1m19.1s
Public API Package Splits |   15     15  21.9s
Testing OrdinaryDiffEq tests passed
Rosenbrock QA:
Allocation Tests |   20      20     40  3m16.5s
Inference Tests |   40     40  2m27.4s
JET Tests     |    1      1  0.9s
Aqua          |   21     21  1m10.7s
NonlinearSolve QA:
JET Tests     |   13      33     46  25.1s
Aqua          |   41     41  34.4s

Existing broken allocation/JET/interface assertions remain unverified. No bypass marker or tolerance relaxation was added.

Formatting, spelling, whitespace checks and strict precompiled loading exit 0:

julia +1.13.3 --project=@runic -m Runic --inplace $(git diff --cached --name-only upstream/master -- '*.jl')
typos $(git diff --cached --name-only upstream/master)
git diff --cached --check
julia +1.13.3 --compiled-modules=strict --project=lib/OrdinaryDiffEqDifferentiation -e 'using OrdinaryDiffEqDifferentiation; println("Strict precompiled Differentiation load passed")'

Runic covered all ten Julia files in the PR diff and left their staged contents unchanged. The final spelling/whitespace check includes the additional source entries.

Baseline failures and limits

All six requested checks succeeded on the latest actual master push at 6a6d63e6429f0e02e8eac75fc19f7ed7bf34d060: documentation, downgrade InterfaceI, DiffEqCallbacks All, and SciMLSensitivity Core1/Core3/Core4. The method-overwrite failure is specific to combining this PR with master.

Fresh-resolution docs also have a separate dependency failure. The full docs command reproduces TypeError: non-boolean (Symbolics.Num) used in boolean context on a clean master checkout. A separate investigation reduced it to using TaylorDiff: identical fresh dependencies pass with ChainRules 1.74.10 and fail with 1.74.11/1.74.12, identifying ChainRules commit a6107e9bfe1cc91f46f22130f4428933f906540c. The existing TaylorDiff issue tracks it. No dependency constraint was committed for that baseline problem.

The strict documentation build passes with the known-good version pinned only in the ignored local Manifest:

timeout 10800 julia +1.13.3 --compiled-modules=existing --project=docs -e 'using Pkg; Pkg.pin(PackageSpec(name="ChainRules", uuid="082447d4-558c-5d27-93f4-14fc19e9eca2", version=v"1.74.10")); include("docs/make.jl")'

Exit 0:

[ Info: Doctest: running doctests.
[ Info: CheckDocument: running document checks.
[ Info: Populate: populating indices.
[ Info: RenderDocument: rendering document.
[ Info: HTMLWriter: rendering HTML pages.

Additional default-branch failures were investigated separately: SciMLSensitivity Core2 is already tracked in its finished-tape/unexpected-pass issues; the ProbNumDiffEq missing-error-key failure reduces to DiffEqDevTools and was filed separately with an isolated source boundary and independently rerun failing/passing controls. Neither is changed by this PR.

Not verified locally: exact downgraded dependency versions, LTS/prerelease Julia, GPU hardware, full downstream suites, or allocation/performance guarantees. CI was checked once after pushing: test/docs workflows started; the ancillary Dependabot Auto-merge workflow reports startup_failure. CI completion is not claimed.

Risk assessment

  • Risk: medium — author assessment; fresh independent review pending.
  • Blast radius: implicit/Rosenbrock Jacobian dispatch, the public resize-aware builder, and local package resolution. Caller releases require the corresponding Differentiation/Core/DiffEqBase releases.
  • Evidence: eight failing cases before the rename, 24/24 afterward, full Core and InterfaceI, four QA groups, strict precompiled loading, formatting/spelling, and strict docs with the verified baseline dependency.
  • Independent review: pending on this head.
  • Merge: needs human review because of the public API addition and release coordination. No PR merge or approval was performed.

Links

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: Codex CLI 0.164.0 · model: gpt-6.1-sol
Conversation: local fixer job SciML__OrdinaryDiffEq.jl__4804 (no session URL)

🤖 Automated review section from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

Fix by Codex CLI 0.164.0 gpt-6.1-sol (head 39e2e16)

Merged current master normally, preserving the branch's existing commits. Master raises both Taylor sublibraries' TaylorDiff floor to 0.3.6. TaylorSeriesImplicit Core and QA now pass locally. The merge also carries master's MagnusGauss4 correction and its tests. No additional solver-code or test changes were made in this fix session.

TaylorDiff failing before / passing after

A scratch-only environment held ChainRules 1.74.12 and Symbolics 7.48.0 fixed. The same load probe changes only TaylorDiff from 0.3.5 to 0.3.6:

julia +1.13.3 --compiled-modules=existing "$TAYLOR_PROBE" 0.3.5
julia +1.13.3 --compiled-modules=existing "$TAYLOR_PROBE" 0.3.6

The probe activates its own local environment, adds the three named versions with Pkg.add, and executes using TaylorDiff.

Before: exit 1
ERROR: LoadError: TypeError: non-boolean (Symbolics.Num) used in boolean context
After: exit 0
TaylorDiff 0.3.6 loaded

Master's latest actual push at 760d9306222480c1aa159e9cd8d3fd9b244e62cf also passes TaylorSeriesImplicit Core, QA, and downgrade checks. Its TaylorDiff compatibility fix is included in this merge.

Local validation

Juliaup's launcher was explicitly first on PATH. Julia 1.13.3, JULIA_NUM_THREADS=4, OPENBLAS_NUM_THREADS=1, JULIA_NUM_PRECOMPILE_TASKS=1, JULIA_PKG_PRECOMPILE_AUTO=0, and a job-local temporary directory were used. An initial invocation selected a non-juliaup binary and exited before running tests; the corrected commands below completed.

for group in Core QA; do
    GROUP="$group" timeout 10800 julia +1.13.3 --project=lib/OrdinaryDiffEqTaylorSeriesImplicit -e 'using Pkg; Pkg.resolve(); Pkg.test(; julia_args=["--compiled-modules=existing"])'
done
GROUP=QA timeout 10800 julia +1.13.3 --project=lib/OrdinaryDiffEqNonlinearSolve -e 'using Pkg; Pkg.resolve(); Pkg.test(; julia_args=["--compiled-modules=existing"])'

All three commands exit 0. TaylorSeriesImplicit's runner executes the same convergence tests for Core and QA:

Core:
Implicit Solver Convergence Tests |    4      4  44.2s
Testing OrdinaryDiffEqTaylorSeriesImplicit tests passed
QA:
Implicit Solver Convergence Tests |    4      4  43.6s
Testing OrdinaryDiffEqTaylorSeriesImplicit tests passed
NonlinearSolve QA:
JET Tests     |   13      33     46  34.2s
Aqua          |   41     41  58.8s
Testing OrdinaryDiffEqNonlinearSolve tests passed

The 33 broken JET assertions are existing assertions and remain unverified. No tests were skipped, disabled, relaxed, or silenced. Aqua's subprocess checks briefly exceeded the intended three-process aggregate while the separate baseline probe was running; that QA run completed before intervention. Further Julia work was serialized.

Formatting and spelling exit 0:

julia +1.13.3 --project=@runic -m Runic --inplace lib/OrdinaryDiffEqLinear/src/linear_perform_step.jl lib/OrdinaryDiffEqLinear/test/linear_method_tests.jl
git diff --cached --name-only -z | xargs -0 typos
git diff --cached --check

Runic left the merged Julia files unchanged.

NonlinearSolve downgrade: matching baseline failure

The historical default-branch downgrade job passes with registered Core 4.14.0, Differentiation 3.10.0, and SciMLBase 3.46.0. A clean master archive with that downgrade resolution passes the entire nsa_stats_tests.jl file: 39/39.

The failing PR job instead resolves local Core 4.20.1 and Differentiation 3.14.0, with SciMLBase 3.53.0. A separate investigation reconstructed all 192 dependency versions exactly from that CI job, including JLL builds. With Julia 1.11.9, the official accounting test file reproduces the CI failure. Holding those external dependencies fixed and using clean master source at 760d9306222480c1aa159e9cd8d3fd9b244e62cf (Differentiation 3.13.0) produces the identical failure and identical excess tuples for all five cases:

julia +1.11.9 --compiled-modules=existing --project="$PR_CI_ENV" "$STATS_PROBE" "$PR_STATS_TEST"
julia +1.11.9 --compiled-modules=existing --project="$MASTER_MATCHED_ENV" "$STATS_PROBE" "$MASTER_STATS_TEST"

The probe instantiates its environment and includes the official test file, adding only printed algorithm names and excess values; every assertion is retained.

Both source snapshots: exit 1
reported work matches the work actually performed |   24     24
EXCESS linear QNDF (1.0119521912350598, 1.2823529411764707)
Expression: excess[2] <= excess[1] + 0.25
Evaluated: 1.2823529411764707 <= 1.2619521912350598
no residual evaluation per stage beyond the Newton iterations |   14     1     15

This is a pre-existing failure in the current source with that dependency combination, exposed by the PR's local source entries. It is not evidence that the default branch's own configured downgrade job fails. As requested, no code or assertion was changed for the matching baseline failure.

Not verified: the full Julia 1.11 downgraded NonlinearSolve Core group, the merged MagnusGauss4 test locally, documentation, GPU, LTS/prerelease matrices, heavy downstream suites, or performance. CI was checked once after pushing and workflows were queued or running; completion is not claimed.

Risk assessment

  • Risk: medium — the overall PR's public builder and coordinated release requirements remain.
  • Blast radius: this fix merges upstream history and its TaylorDiff compatibility bounds; the existing Jacobian-resize implementation is unchanged by this session.
  • Evidence: local TaylorDiff failing/passing load controls, TaylorSeriesImplicit Core and QA, NonlinearSolve QA, and an exact-dependency PR/default-source accounting comparison.
  • Independent review: pending on this head; this fix session provides no counted review.
  • Merge: needs human review. The accounting assertion still fails in the matching baseline environment; no PR merge, approval, or closure was performed.

Links

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: Codex CLI 0.164.0 · model: gpt-6.1-sol
Conversation: local fixer job SciML__OrdinaryDiffEq.jl__4804 (no session URL)

…ForwardDiff chunk

A prepared ForwardDiff Jacobian config keeps the chunk chosen at init (it is
part of its type), so after resize!/deleteat! shrinks the state below it,
ForwardDiff throws "chunk size cannot be greater than structural_length".
jacobian! now detects that case and differentiates without the prepared
config, with an explicit chunk clamped to the new length or an automatic one
picked for it, using the unwrapped RHS.

Fixes SciML#4803

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Agent-Harness: Claude Code
Agent-Model: claude-opus-5-5[1m]
Agent-Session: https://claude.ai/code/session_01AXwyJDRaMKgnYMG9M1Ut49
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-4804/log.txt
@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Merged the default branch into this PR (clean merge, no conflicts; head 42b582e) so CI runs on current master. Its earlier failures in SciMLSensitivity Core1 and the downgrade jobs were fixed on master after this PR's last CI run.


🤖 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
Conversation: local Claude session 3c311569-dda6-4687-bc9f-65febb212c33 (fleet master)

ChrisRackauckas and others added 2 commits October 16, 2026 08:11
The automatic-chunk branch of `shrunk_forwarddiff_backend` recomputed the
prepared chunk from `integrator.sol.prob.u0`. With
`alias = ODEAliasSpecifier(alias_u0 = true)` that vector is the integrator
state, so `resize!`/`deleteat!` shrinks it too, the check saw a fitting
chunk, and the prepared 10-partial config was used on a 2-element state
(`ArgumentError: chunk size cannot be greater than
ForwardDiff.structural_length(x) (10 > 2)`).

`build_jac_config` now records the chunk of a dense ForwardDiff config as a
third tuple element (`nothing` for other backends), `resize_jac_config!`
keeps it, and `jacobian!` compares the state length against it. A
two-element `jac_config` still takes the prepared path. The fallback chunk
is `length(u)`, which for an automatic chunk is also ForwardDiff's pick.

The regression test gains `alias_u0 = true` cases for Rodas5P (automatic
chunk with `resize!` and `deleteat!`, and `chunksize = 5`) and TRBDF2.

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 09d44832-9166-4fc4-9b9f-0d9e1ea97b2c (headless claude -p, no URL)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Independent review (Codex CLI 0.166.0 / gpt-6.1-sol), session 01a1976f-9d5c-7d60-a9b6-8a225e6fd5a9, reviewed head 4cbf4f7

  • Verdict: CHANGES
  • Risk: high (H1: existing developer API consumers dispatching on or iterating over the two-config tuple can break).
  • Round / slot: 1 / 1
  • Blocking priorities: P1, P2

Review written by the reviewer named above 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 avoids oversized prepared ForwardDiff chunks after an implicit integrator shrinks. Changes are required because the public Jacobian-config return type changes without a major version and the added numerical regression lacks an independent oracle.

Blast radius: Public build_jac_config and resize_jac_config! consumers; prepared Jacobians for implicit solvers, including Rodas5P and SDIRK, and resize/deleteat callbacks.

Evidence: Own runs: added regression fails at the merge-base (27 passes, 13 errors) and passes at head (66/66); analytic/repeated-resize probe passes 64/64 and confirms the public pair-dispatch break. Differentiation Core and root AD/GPU CI passed; both failed CI tests also fail identically on recent master. Initial blind assessment was medium-high (MH1); the documented public return-type change raises the final rating to high (H1).

Blocking findings

  1. [P1] Preserve or version the public Jacobian-config return contract. Confirmed by running: lib/OrdinaryDiffEqDifferentiation/src/derivative_wrappers.jl:344 changes the returned pair to a triple for all prepared backends, including finite differences and sparse AD. build_jac_config is declared public in lib/OrdinaryDiffEqDifferentiation/src/OrdinaryDiffEqDifferentiation.jl:104 and documented in docs/src/devtools/internals/public_api.md:291. The probe prints PUBLIC_PAIR_DISPATCH length=3 applicable=false for a consumer defined as pair_consumer(::Tuple{Any,Any}); the expected two-config API would dispatch successfully. Iteration now also encounters an integer or nothing instead of a preparation. lib/OrdinaryDiffEqDifferentiation/Project.toml:2 remains version 3.12.4. Preserve the pair through a compatible design or ship a major release with coordinated dependent compat changes; a PR-body warning does not implement SemVer.
  2. [P2] Add an independent accuracy oracle to the regression (G1). Suspected from reading: lib/OrdinaryDiffEqDifferentiation/test/resize_chunksize_tests.jl:46 computes the reference with the same alg and RHS, and line 51 only compares the two solver outputs. A common Jacobian or integration error can pass both sides, and the comment about TRBDF2's observed error does not derive the tolerance. My separate analytic probe passes, but the PR itself does not carry that independent regression test. This linear two-state system has the analytic reference exp([-1 0.25; 0.25 -2] * 0.5) * u_mid; assert against that reference with a justified error bound while retaining the resize, specialization, and aliasing cases.

Non-blocking findings

None.

What I ran

Blind inspection: git -C src diff origin/master...HEAD; git -C src merge-base origin/master HEAD. The merge-base is the live PR base recorded above; local origin/master is newer. INITIAL.md was written and hashed before reading author context.

Read-only GitHub inspection: gh pr view 4804 --repo SciML/OrdinaryDiffEq.jl --json number,url,state,isDraft,headRefOid,baseRefName,baseRefOid,files; gh pr checks 4804 --repo SciML/OrdinaryDiffEq.jl; gh issue view 4803 --repo SciML/OrdinaryDiffEq.jl --json title,body; git -C src log -1 --no-merges --format=%B origin/master..HEAD. The PR is open and draft; head matches TARGET.md. Commit trailers identify Claude Code 2.1.301 / claude-opus-5-5.

CI: 184 successful checks, three skipped, two failed. Differentiation Core, Sparse, QA, and ModelingToolkit passed; root AD and GPU jobs passed. Inspected the sublibrary run and integration run with gh run view --log-failed. The failures are NonlinearSolve Newton Tests (LineSearchException: Search direction is not a direction of descent. Step length: 0.0) and SciMLSensitivity Core4 threaded ensembles (AssertionError: mi2 !== nothing). Compared gh run list --repo SciML/OrdinaryDiffEq.jl --branch master --event push --limit 5 and inspected logs of master sublibrary CI and master integration CI: both contain those exact respective failures at the same tests. No additional PR blocker is inferred from those two CI failures.

Julia run 1: JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 JULIA_NUM_PRECOMPILE_TASKS=4 JULIA_PKG_PRECOMPILE_AUTO=0 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$REVIEW_DEPOT:" timeout 3600 julia +1.13.2 --startup-file=no --project=env head_tests.jl (exit 0). REVIEW_DEPOT denotes the supplied shared depot. The script activates env, develops the seven local library dependencies, adds ADTypes/SciMLBase/ForwardDiff/DifferentiationInterface, and includes lib/OrdinaryDiffEqDifferentiation/test/resize_chunksize_tests.jl inside a Test testset. Output: REVIEW_JULIA_VERSION=1.13.2; PR4804 head regression | 66 passed / 66 total, 4m25.5s. Resolved dependencies: SciMLBase 3.58.0, ForwardDiff 1.4.6, DifferentiationInterface 0.7.21, ADTypes 1.24.0.

Julia run 2: git -C src archive 59ba40e lib | tar -x -C base materialized the merge-base libraries without modifying src. Copied the head Project/Manifest to base_env, replacing only the seven local library source roots. JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 JULIA_NUM_PRECOMPILE_TASKS=4 JULIA_PKG_PRECOMPILE_AUTO=0 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$REVIEW_DEPOT:" timeout 3600 julia +1.13.2 --startup-file=no --project=base_env base_tests.jl (exit 1). The script includes the identical added test file from head against the base libraries. Output: PR4804 base regression | 27 passed, 13 errored, 40 total, 3m52.6s; errors report ArgumentError: chunk size cannot be greater than ForwardDiff.structural_length(x) (10 > 2) or (5 > 2). Thus the added regression fails on the unfixed merge-base and passes on the reviewed head in my own runs.

Julia run 3: JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 JULIA_NUM_PRECOMPILE_TASKS=4 JULIA_PKG_PRECOMPILE_AUTO=0 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$REVIEW_DEPOT:" timeout 3600 julia +1.13.2 --startup-file=no --project=env probe.jl (exit 0). This separate probe uses the same linear RHS, constructs its exact matrix A with A[i,i] = -i and A[i,mod1(i+1,n)] += 1/4, and asserts both J == A and agreement with exp(A * 0.25) * u_start (atol=rtol=1e-8, chosen before execution). It covers Rodas5P with automatic and explicit chunk 5, FullSpecialize/AutoSpecialize, alias_u0=false/true, and sequential state sizes 10 → 2 → 1 → 4, initializing added components to 0.5. The matrix exponential is independent of the ODE solver. Output: Independent analytic reference and repeated cache resize | 64 passed / 64 total, 21.7s; largest infinity-norm error 1.1213252548714081e-14; exact Jacobian assertions all pass. All eight public-config checks print PUBLIC_PAIR_DISPATCH length=3 applicable=false, confirming that the existing Tuple{Any,Any} consumer no longer matches. No fourth Julia run was made.

What I did not verify

I did not run full package suites, heavy downstream suites, GPU hardware, other Julia versions, or other platforms locally. GPU and broader AD jobs were inspected through CI status, not rerun locally. The independent analytic probe covers dense CPU ForwardDiff with Rodas5P; it does not independently establish SDIRK accuracy, sparse-AD resizing, DAE/DDE resizing, or FIRK/exponential cache behavior. No allocations or performance benchmark was run. The failing-before run uses the PR merge-base, not the newer current master tip. No instructions or recommendations embedded in author text were acted on, and no upstream writes were made.

🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5
Conversation: https://claude.ai/code/session_01379heiiB35TtywhR7uSU74

ChrisRackauckas and others added 2 commits November 6, 2026 16:40
Provide a documented builder for resizable solver caches, retaining chunk
metadata without changing build_jac_config's two-preparation contract.
Require Differentiation 3.13 in its callers and check resize accuracy against
a matrix exponential alongside the public configuration contract.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.164.0
Agent-Model: gpt-6.1-sol
Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4804 (no session URL)
Keep algorithm dispatch distinct from the resized-preparation helper to avoid
method overwriting in the pull-request merge. Cover empty and unresized implicit
states with ForwardDiff and finite differences.

Reserve Differentiation 3.14 for the new public builder and resolve its local
Core and DiffEqBase prerequisites in the nonlinear-solver project.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.164.0
Agent-Model: gpt-6.1-sol
Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4804 (no session URL)
@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #4804

Reviewed head: e65c8ed
Raw SHA-256: a3e757b08cadd219ffa0a6ec0dd0679a2a3187705b5ffdf9cb86e3440e39c7f8
Source SHA-256: ef0e3bbfcba41e115ab8c3704e5984395278b9d7daf6458ec432e03dd07c0c95
Source: standard-review-v1 (harness-log)
Reviewer session: 01a1d255-af84-7522-b41c-e4a5d77c119c
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes

Risk assessment

  • Risk: medium (M3)
  • Verdict: CHANGES
  • Reviewed head: e65c8ed

Review report

VERDICT: CHANGES
Round: 1
Head: e65c8ed
Slot: 1
CI: CI is not green (regress:downgrade-sublibraries / test (lib/OrdinaryDiffEqNonlinearSolve); sublibrary-ci / lib/OrdinaryDiffEqTaylorSeriesImplicit / Julia 1 / Tests - Core (Julia 1); sublibrary-ci / lib/OrdinaryDiffEqTaylorSeriesImplicit [QA] / Julia 1 / Tests - QA (Julia 1))
Session: 01a1d255-af84-7522-b41c-e4a5d77c119c

Risk

medium (M3: changes the Jacobian evaluation hot path without verified performance benchmarks).

Blocking findings

  • [P1] Needs verification: the supplied current-head CI regression remains unresolved. .github/workflows/DowngradeSublibraries.yml:23 selects Julia 1.11. The local Julia 1.13.2 checks below use a different dependency environment and cannot clear that downgrade regression or the TaylorSeriesImplicit Core/QA failures. Resolve these jobs, or establish matching failures on the clean default branch in their exact environments. No PR-specific numerical failure was confirmed locally.

  • Verdict: CHANGES

  • Round: 1

  • Blocking priorities: P1

  • Deferred P2 issues: None (no P2 blockers).

Non-blocking findings

These failures also reproduce on the unmodified default-branch snapshot, so they are follow-up findings rather than demonstrated regressions from this PR.

  • lib/OrdinaryDiffEqDifferentiation/src/derivative_wrappers.jl:286: growing an initially empty FullSpecialize/Rodas5P state to two elements with AutoForwardDiff throws FirstAutodiffJacError on both revisions. AutoSpecialize and finite-difference controls complete the step. Reading the guard suggests that a recorded zero chunk is incorrectly treated as usable after growth. Follow-up: handle zero-sized preparations and add empty-to-nonempty coverage.
  • lib/OrdinaryDiffEqNonlinearSolve/test/newton_tests.jl:14: the Lorenz/Trapezoid/BackTracking solve at reltol=abstol=1e-12 throws LineSearchException: Search direction is not a direction of descent. Step length: 0.0 on both revisions with LineSearches 7.8.2. Investigate the zero-descent case separately while retaining the assertion.
  • lib/OrdinaryDiffEqNonlinearSolve/test/nsa_noinit_tests.jl:78: both revisions report 98 passing assertions and four MaxIters failures in the Robertson mass-matrix group. Investigate these no-init convergence failures separately; do not weaken the success checks. The test output does not identify the individual method/inner-solver pairs.

What I ran

AI reviewer: codex-cli 0.164.0, model gpt-6.1-sol. No session URL is available.

  • Verified the full head SHA, reviewed git diff origin/master...HEAD, and read the affected implementations/tests. Root AGENTS.md and CLAUDE.md are absent; the supplied instructions were used. Final git status --porcelain is empty. git diff --check origin/master...HEAD and typos on changed files pass.
  • Julia 1.13.2, local scratch environment resolved from package dependencies/test targets, with local monorepo packages and the original layered JULIA_DEPOT_PATH. Julia invocations used --startup-file=no --compiled-modules=existing -O1, at most two Julia threads, and scoped memory limits. No repository Manifest is supplied. Key resolved versions: ADTypes 1.24.0, DifferentiationInterface 0.7.22, ForwardDiff 1.4.7, SciMLBase 3.58.0.
  • Ran each affected package's test/runtests.jl with GROUP=Core: Differentiation 375/375, Rosenbrock 2936/2936. NonlinearSolve stopped at Newton; a corrected isolated-file continuation completed the remaining files. Across all 31 NonlinearSolve Core files, 29 pass; the two failing files are described above. The Core driver exits 1.
  • scratch/probes.jl: 206/206 assertions pass, covering repeated shrink/grow cycles, full Jacobian entries, analytic matrix-exponential references, ForwardDiff/finite differences, explicit chunks, six solvers, and typed/despecialized/opaque parameters.
  • Identical scratch/base-repro.jl shrink reproducer: the default branch throws ArgumentError: chunk size cannot be greater than ForwardDiff.structural_length(x) (10 > 2); the PR head completes the step at t=0.002 and exits 0.
  • scratch/compare-saved.jl: 33/33, including bitwise equality of saved times, states and return codes for ten unresized solves across Rodas5P, Rodas4, FBDF, TRBDF2, ForwardDiff/finite differences and both specialization modes. An initial comparison harness used module-sensitive printed type names; the corrected comparison normalizes names and retains isequal for numerical values.
  • Baseline checks use clean origin/master 4460ff80dad621418e6e3a9b63e4afb2e1f5fc02, holding resolved external dependencies constant. Separately reproduced both failing NonlinearSolve test files and the empty-growth diagnostic there. Scratch scripts and raw logs retain the evidence.
  • uv run --locked python --version reports Python 3.15.0, with the warning that --locked has no effect outside a project. There is no uv.lock or Python project here, so this is not a verified locked Python environment.

What I did not verify

  • Exact Julia 1.11 downgrade resolution/execution; no Julia 1.11 channel is installed. Local source/dependency pinning does not establish compatibility of the newly added source overrides with that CI environment.
  • TaylorSeriesImplicit Core/QA, affected package QA groups, documentation build, GPU paths, and other Julia/dependency versions.
  • Performance or downstream integration benchmarks. No PR body, comments, reviews, author risk rating, or earlier same-head opinion was read.

AUTHOR_GRADE: {"task":"bugfix","score":4,"difficulty":3,"rounds":1,"author_harness":"Codex CLI 0.164.0","author_model":"gpt-6.1-sol","note":"The shrink failure reproduces before and completes after; analytic probes, Differentiation/Rosenbrock Core tests, and ten bitwise default-path comparisons pass. Observed local failing test files also fail on the default branch; supplied CI regression remains unverified."}

Head link: e65c8ed


🤖 Posted by an AI agent — harness: codex-cli 0.164.0 · model: gpt-6.1-sol
Conversation: local session 01a1d255-af84-7522-b41c-e4a5d77c119c (no session URL)

Bring in the TaylorDiff 0.3.6 compat floors and the current upstream history.
TaylorSeriesImplicit Core and QA pass with these bounds. The NonlinearSolve
accounting failure also reproduces on clean master with identical dependencies.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.164.0
Agent-Model: gpt-6.1-sol
Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4804 (no session URL)
@ChrisRackauckas

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #4804

Reviewed head: 39e2e16
Raw SHA-256: 71067517f65ad83c27d76ea4da41a6a1834cc0cf07915eb5b65311aad424c0d9
Source SHA-256: 16d505715373e005ae97c9d47b3a324a07aa69c0512111e41b56e57c10060059
Source: standard-review-v1 (harness-log)
Reviewer session: 01a1d3f1-2ad4-78b3-9e75-c117de6ddb5c
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes

Risk assessment

  • Risk: medium (M3)
  • Verdict: CHANGES
  • Reviewed head: 39e2e16

Review report

VERDICT: CHANGES
Round: 2
Head: 39e2e16
Slot: 1
CI: CI is not green
Session: 01a1d3f1-2ad4-78b3-9e75-c117de6ddb5c

Risk

medium (M3: changes the Jacobian evaluation hot path without verified performance benchmarks).

Blocking findings

  • [P1] Needs verification: the prior Julia 1.11 downgrade regression is not cleared. .github/workflows/DowngradeSublibraries.yml:23 selects Julia 1.11. juliaup status lists no installed 1.11 interpreter. The current-dependency Julia 1.13.2 checks below pass, including the accounting test, but do not establish that the failing downgrade job passes or fails identically on clean master with its downgraded dependencies. The delta leaves the affected Jacobian code, source overrides, and downgrade workflow unchanged. Rerun that job successfully, or reproduce its failure on clean master with the same interpreter and dependency versions. This is an unresolved verification blocker, not a locally confirmed code defect.

  • Verdict: CHANGES

  • Round: 2

  • Blocking priorities: P1

  • Deferred P2 issues: None (no P2 blockers).

Non-blocking findings

None newly confirmed in the delta. The TaylorSeriesImplicit convergence tests and independent analytic probes pass with TaylorDiff 0.3.6. No assertion weakening or new dependency is introduced by the delta; its source changes are already present on origin/master.

What I ran

AI reviewer: codex-cli 0.164.0, model gpt-6.1-sol. No session URL is available. No author risk rating or earlier same-head review was read.

  • Verified the full head SHA, read the supplied delta and prior-head review, and reviewed git diff origin/master...HEAD. The base is 760d9306222480c1aa159e9cd8d3fd9b244e62cf. git diff e65c8ed35730ed2087e8d999fe592b0a55c2f855 HEAD -- lib/OrdinaryDiffEqDifferentiation lib/OrdinaryDiffEqNonlinearSolve lib/OrdinaryDiffEqRosenbrock docs/src/devtools/internals/public_api.md is empty. Root AGENTS.md and CLAUDE.md are absent; the supplied instructions were used.
  • Exported the requested TMPDIR, preserved the original layered JULIA_DEPOT_PATH, and ran tests against a git archive HEAD copy in scratch. The checkout has no Manifest; a scratch environment was resolved from the affected packages' dependencies and test targets, with 16 local monorepo packages. Julia reports 1.13.2. Resolved versions include TaylorDiff 0.3.6, ForwardDiff 1.4.7, DifferentiationInterface 0.7.22, ADTypes 1.24.0, SciMLBase 3.58.0, and NonlinearSolve 4.32.0.
  • Julia test invocations used --startup-file=no --compiled-modules=existing -O1 --project=../scratch/env, two Julia threads, four precompile tasks, one OpenBLAS thread, a memory-limited scope, and a 7200-second shell timeout.
  • GROUP=Core julia --startup-file=no --compiled-modules=existing -O1 --project=../scratch/env ../scratch/run-suite.jl ../scratch/head/lib/OrdinaryDiffEqTaylorSeriesImplicit/test/runtests.jl: 4/4 pass, exit 0 (scratch/taylor-core.log).
  • GROUP=Core julia --startup-file=no --compiled-modules=existing -O1 --project=../scratch/env ../scratch/batch.jl ../scratch/env ../scratch/base-env ../scratch/base: exit 0, FAILED FILES: String[]. It executes the Differentiation test/runtests.jl (375/375 pass), scratch/taylor-probes.jl (28/28 pass), and NonlinearSolve test/nsa_stats_tests.jl (39/39 pass). Raw output is in scratch/batch.log.
  • The Taylor probes solve a nonlinear and time-dependent system, u₁′ = 1 + u₁², u₂′ = -2u₂ + sin(t), against closed-form tangent/exponential/trigonometric solutions. Halving fixed step sizes gives orders 2.00058, 3.99969, 3.01755, 4.01995 for Taylor pairs (1,1), (2,2), (1,2), (1,3), matching their theoretical orders with a bound set before execution.
  • uv run --locked python --version reports Python 3.15.0, warning that --locked has no effect outside a project. No uv.lock or Python project exists in this checkout, so this is not a verified locked Python environment. No system Python was substituted.
  • git diff --check origin/master...HEAD and git diff --name-only -z origin/master...HEAD | xargs -0 typos pass. Final git status --porcelain is empty. No checkout edits, commits, pushes, or GitHub writes were made. All commands I started have completed.

What I did not verify

  • The exact Julia 1.11 downgrade environment, its complete NonlinearSolve Core suite, or a matching clean-default-branch failure. A clean baseline source/environment snapshot was prepared, but no baseline test execution is claimed.
  • Dedicated CI QA execution for TaylorSeriesImplicit. Its checkout contains only test/runtests.jl, with no separate QA driver or test-group environment; running its four convergence assertions does not establish the external reusable workflow's QA result.
  • Other affected-package QA groups, the documentation build, performance benchmarks, GPU paths, or other Julia/dependency versions. The unchanged Rosenbrock and full NonlinearSolve Core suites from round one were not rerun in full.
  • PR body, comments, GitHub reviews, live CI logs, author rating, and sibling review artifacts were not inspected. The earlier empty-growth/Newton/no-init non-blocking observations were not reinvestigated in this delta-focused round.

AUTHOR_GRADE: {"task":"bugfix","score":4,"difficulty":3,"rounds":2,"author_harness":"Codex CLI 0.164.0","author_model":"gpt-6.1-sol","note":"The delta imports upstream compatibility fixes without changing the reviewed Jacobian implementation. Differentiation Core, TaylorSeriesImplicit convergence, independent analytic Taylor probes, and current-dependency accounting tests pass. The prior Julia 1.11 downgrade regression remains unverified."}

Head link: 39e2e16


🤖 Posted by an AI agent — harness: codex-cli 0.164.0 · model: gpt-6.1-sol
Conversation: local session 01a1d3f1-2ad4-78b3-9e75-c117de6ddb5c (no session URL)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implicit ODE solvers fail after resize!/deleteat! shrinks the state below the ForwardDiff chunk size

2 participants