Skip to content

Evaluate Jacobians into a private residual buffer - #1365

Open
ChrisRackauckas-Claude wants to merge 5 commits into
SciML:masterfrom
ChrisRackauckas-Claude:jacobian-eval-private-fu
Open

ChrisRackauckas-Claude wants to merge 5 commits into
SciML:masterfrom
ChrisRackauckas-Claude:jacobian-eval-private-fu

Conversation

@ChrisRackauckas-Claude

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

Copy link
Copy Markdown
Member

Please ignore until reviewed by @ChrisRackauckas.

What changed and why

construct_jacobian_cache handed the solver's own residual array to JacobianCache as the output buffer, and (cache::JacobianCache)(u) passes that buffer as y to DI.jacobian!. For an in-place problem differentiated with ForwardDiff, every Jacobian evaluation therefore overwrote the solver's fu with the dual-number primal of f(u).

That primal is not bitwise equal to a plain f(u) call. For example, sin of a Dual goes through sincos. On a 100-dim dense test problem (du = A*u + 150 .* sin.(u) .- p), 74 of 100 entries of fu change in the last bits after jac_cache(u0). The Jacobian itself is bitwise identical. So after each Jacobian evaluation, the residual used by the Newton step and by the termination check silently became the AD primal.

This PR passes the cache's existing private fu_cache instead. fu_cache is already allocated by construct_jacobian_cache for DI preparation, so no buffer is added. The diff is one line in lib/NonlinearSolveBase/src/jacobian.jl, plus a test.

This is also the prerequisite for the follow-up PR that reuses the init-time Jacobian on the first Newton step. That PR can only be bitwise identical to its base if a Jacobian evaluation no longer has this side effect.

Behavior change: in-place AD iterates change at roundoff level

In-place problems with an AD Jacobian now step from the plain residual instead of the AD primal, so their iterates change at roundoff level. I compared master and this branch on 98 solver/problem configurations:

  • Problems: dense 100 IIP and OOP, dense IIP with a user jac, sparse 1000 with a jac_prototype and with a sparsity detector, SVector{4}, scalar.
  • Algorithms: NR, NR with FiniteDiff, NR + GMRES (lazy and concrete), TR, TR(Hei), LM, PseudoTransient, Broyden/Klement with true-Jacobian init, and two polyalgorithms with alias_u0 = true.
  • Each configuration covers a full solve, the iterates of a step! loop, and solve! after reinit! with a new u0/p, a new p, and the original values.

87 of 98 configurations are bitwise identical in every iterate, residual, retcode and stat. That includes all OOP, SVector, scalar, sparse, user-jac and matrix-free cases. The 11 that differ are all dense in-place ForwardDiff cases:

case retcode master/PR nsteps final-u rel. diff max iterate rel. diff
NR Success/Success 5/5 1.3e-17 4.6e-15
NR + GMRES (concrete J) Success/Success 5/5 4.7e-17 4.7e-15
TR Success/Success 4/4 6.8e-17 1.0e-13
TR (Hei) Success/Success 13/13 2.1e-16 4.7e-14
LM Success/Success 11/11 1.6e-14 2.7e-13
PseudoTransient Success/Success 11/11 3.4e-19 1.9e-15
Broyden (true J init) Success/Success 8/8 0 8.4e-15
Klement (true J diagonal) Success/Success 10/10 0 3.4e-15
PolyAlg(PT, NR) Success/Success 13/13 8.8e-17 0
PolyAlg(PT, Broyden true J) Success/Success 16/16 8.1e-17 0
Klement (true J), diverging MaxIters/Unstable 1000/239 — —

The last row is a solve that diverges on both master and this branch: on master its iterates reach 1e259 before MaxIters. A roundoff-level change alters how it fails. No converging case changed retcode or step count.

Cost

The buffer already existed, so there is no new allocation. Pinned with taskset, dense 100 IIP, solve(prob, alg):

alg init bytes master → PR solve bytes min µs master → PR
NewtonRaphson 183240 → 183208 263296 → 263296 3799 → 3805
TrustRegion 274248 → 274248 274248 → 274248 5710 → 5705
LevenbergMarquardt 444608 → 444608 1296904 → 1296904 12466 → 12452

Verification

New test, lib/NonlinearSolveBase/test/jacobian_private_fu.jl: after jac_cache(u), the residual array equals a plain f!(fu, u, p) call bitwise. It also checks the Jacobian against the analytic one.

Failing before the fix (origin/master 0055e314):

A: Test Failed at .../lib/NonlinearSolveBase/test/jacobian_private_fu.jl:20
  Expression: fu == fu_plain
   Evaluated: [239.26381734800142, 239.6068173480014, ...] == [239.26381734800134, 239.6068173480013, ...]
Test Summary: | Pass  Fail  Total  Time
A             |    2     2      4  7.6s

Passing after:

Test Summary: | Pass  Total  Time
A             |    4      4  4.9s

Full suites on this branch (Julia 1.12):

GROUP=Core  (lib/NonlinearSolveBase)  ... Jacobian evaluation leaves the residual untouched |    4      4  2.4s
     Testing NonlinearSolveBase tests passed
GROUP=QA    (lib/NonlinearSolveBase)  QA |   20     20  45.1s
     Testing NonlinearSolveBase tests passed

Runic (Runic --check) and typos are clean on the changed files.

Not verified

  • Downstream sublibrary test suites (FirstOrder, QuasiNewton, SpectralMethods, top-level NonlinearSolve) were not run on this PR alone. Because of machine load, the FirstOrder and QuasiNewton Core groups were run on the stacked follow-up PR, which contains this change. Any test that compares in-place AD iterates bitwise against stored values would see the roundoff change.
  • Julia LTS and pre, GPU, and docs build were not run.
  • Only ForwardDiff was measured. Other DI backends either never write the primal into y or now write it into a private buffer, so they can only become more consistent.
  • No version bump. Following the repo convention, NonlinearSolveBase is released in a separate PR.

Risk assessment

  • Risk: low
  • Blast radius: JacobianCache for in-place problems with an AD Jacobian (dense and sparse) in every solver built on construct_jacobian_cache. No public API change. Iterates of in-place AD solves change at roundoff level, as tabulated above.
  • Evidence: the new test fails before and passes after; the 98-configuration master comparison above; NonlinearSolveBase Core and QA pass; no allocation or time change.
  • Independent review: pending
  • Merge: needs human review. It intentionally changes numerical iterates, even if only at roundoff.

🤖 Generated with Claude Code (model: claude-opus-5-5) https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv

Independent review: Devin Fusion (fusion-claude-opus-5-5-high-sidekick-swe-2-medium) rated it low, verdict MERGE: #1365 (comment)

🤖 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 2b55d35)

Merged current upstream master normally, preserving the private Jacobian residual workspace change. This includes the existing upstream fix for Julia 1.10 polyalgorithm solve! inference: the dynamically selected subcache's return code is asserted as ReturnCode.T.

Both reported LTS failures match the historical master failures, rather than a regression from this PR. Latest master passes both Ubuntu and macOS LTS Core jobs. The upstream fix is #1347. No new solver implementation changes or test relaxations were made.

Local verification

Julia tests used the juliaup launcher with +lts (Julia 1.10.12), four Julia threads, one OpenBLAS thread, JULIA_PKG_PRECOMPILE_AUTO=0, and JULIA_NUM_PRECOMPILE_TASKS=1. All local monorepo dependencies were developed into the local environment. Each test command had an external 3600-second timeout.

Existing inference regression on a clean export of the pre-merge PR head:

timeout 3600 julia +lts --project -e 'using Test; @testset "LTS polyalgorithm inference" begin; include("test/Core/core_tests__item3.jl"); end'

Exit 1:

Test Summary:               | Pass  Error  Total   Time
LTS polyalgorithm inference |    8      1      9  22.9s
  solve() inference         |    8             8  12.9s
  solve!() inference        |           1      1   4.4s

The same inference file, plus this PR's Jacobian regression, on the merged tree:

timeout 3600 julia +lts --project -e 'using Test; @testset "LTS polyalgorithm inference" begin; include("test/Core/core_tests__item3.jl"); end; @testset "Private Jacobian residual" begin; include("lib/NonlinearSolveBase/test/jacobian_private_fu.jl"); end'

Exit 0:

Test Summary:               | Pass  Total   Time
LTS polyalgorithm inference |   16     16  31.8s
Test Summary:             | Pass  Total  Time
Private Jacobian residual |    4      4  2.3s

Full root Core group:

GROUP=Core timeout 3600 julia +lts --project -e 'using Pkg; Pkg.test()'

Exit 0, excerpts:

PolyAlgorithm Type Inference |   16     16  33.1s
Test Summary:                                             | Pass  Total   Time
FastShortcutHomotopyPolyalg + homotopy initialization_alg |   12     12  17.4s
 17.441520 seconds (17.91 M allocations: 1.276 GiB, 2.01% gc time, 99.79% compilation time)
     Testing NonlinearSolve tests passed

Full root QA group:

GROUP=QA timeout 3600 julia +lts --project -e 'using Pkg; Pkg.test()'

Exit 0:

Test Summary: | Pass  Total     Time
QA            |   26     26  1m46.6s
     Testing NonlinearSolve tests passed

Formatting and spelling on the merge's changed files:

git diff HEAD^ HEAD --name-only -- '*.jl' | xargs -d '\n' timeout 3600 julia --project=@runic -m Runic --inplace
git diff HEAD^ HEAD --name-only | xargs -d '\n' typos
git diff --check

All exited 0 with no diagnostics; the working tree stayed clean. The original PR's Jacobian regression file was also formatted and spell-checked successfully.

Not locally verified: macOS, other Julia versions, the other root groups, complete sublibrary groups, GPU/downstream integrations, or a docs build. No documentation or public API was added by this fix. New-head CI was not awaited.

Next counted review must come from a smart model in a fresh session, not this fix session (risk.md § Independent reviews).

Links


🤖 Posted by an AI agent — harness: Codex CLI 0.164.0 · model: gpt-6.1-sol
Conversation: local fixer job SciML__NonlinearSolve.jl__1365 (no session URL)

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

Fix by Muse CLI Code muse-wonder-full-1.0 (head f33569d)

What changed:

  • Merged current upstream master (6b33892) normally into this branch (merge commit 9bd5df6).
  • Raised the TaylorDiff compatibility floor in lib/NonlinearSolveHomotopyContinuation/Project.toml from 0.3.1 to 0.3.6 (commit f33569d). No solver code changed; the private Jacobian residual buffer change under review is untouched.

Why: the two base-green failures routed for this PR (NonlinearSolveHomotopyContinuation Core and QA on Julia 1) both failed while precompiling TaylorDiff 0.3.5, before any test in this repository ran:

ERROR: LoadError: TypeError: non-boolean (Symbolics.Num) used in boolean context
  [1] derivatives_given_output(Ω::Symbolics.Num, ::typeof(tanh), x::Symbolics.Num) @ ChainRules fastmath_able.jl:42
  [3] get_term_raiser(func::Function) @ TaylorDiff utils.jl:56
Failed to precompile TaylorDiff [b36ab563-344f-407b-a36a-4f200bebf99c]

That failure is external to the Jacobian change in this PR. I reproduced it in a scratch environment containing only TaylorDiff 0.3.5 (no code from this repository), where using TaylorDiff exits 1 with the same stacktrace, and in the same kind of scratch environment with TaylorDiff 0.3.6 it exits 0. TaylorDiff 0.3.6 drops its Symbolics dependency. The base run used for comparison passed on 2026-11-03 with the registry state of that day; the PR run on 2026-11-08 resolved the broken TaylorDiff 0.3.5 combination. Raising the floor makes the broken version unselectable, including for the downgrade lane, which also failed with the same TaylorDiff precompile error.

Validation

All Julia commands ran with JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=4 and an external 3600-second timeout, on Julia 1.13.2.

TaylorDiff alone, before and after (scratch environments, no repository code):

julia --project=<scratch-taylor035> -e 'using TaylorDiff'   # TaylorDiff v0.3.5
julia --project=<scratch-taylor036> -e 'using TaylorDiff; println("TAYLORDIFF36_OK")'
taylor035-exit:1
ERROR: LoadError: TypeError: non-boolean (Symbolics.Num) used in boolean context
  [1] derivatives_given_output(Ω::Symbolics.Num, ::typeof(tanh), x::Symbolics.Num) @ ChainRules fastmath_able.jl:42
taylor036-exit:0
TAYLORDIFF36_OK

HomotopyContinuation QA after the change:

GROUP=QA julia --project=lib/NonlinearSolveHomotopyContinuation -e 'using Pkg; Pkg.test()'
QA exit:0
Test Summary: | Pass  Broken  Total     Time
QA            |   19       1     20  1m01.3s
     Testing NonlinearSolveHomotopyContinuation tests passed

(The one broken entry is the pre-existing aqua_broken = (:persistent_tasks,) allowance already present in the QA file.)

HomotopyContinuation Core after the change:

GROUP=Core julia --project=lib/NonlinearSolveHomotopyContinuation -e 'using Pkg; Pkg.test()'
CORE exit:0
AllRoots      |  116    116
Single Root   |   35     35
Taylor Polynomialize |   40     40
     Testing NonlinearSolveHomotopyContinuation tests passed

Both groups resolved TaylorDiff v0.3.6. Core also passed before this commit with the registry state of 2026-11-12 (which already resolves 0.3.6); the compat floor is what excludes the broken 0.3.5 combination that CI hit.

NonlinearSolveBase Core after the change (covers the Jacobian regression test added by this PR):

GROUP=Core julia --project=lib/NonlinearSolveBase -e 'using Pkg; Pkg.test()'
exit:0
Jacobian evaluation leaves the residual untouched |    4      4  2.9s
     Testing NonlinearSolveBase tests passed

Formatting and spelling: julia --project=@runic -m Runic --check on the three Julia files changed by this PR exits 0 (the only file changed by this fix is a Project.toml, which Runic does not format), and typos lib/NonlinearSolveHomotopyContinuation/Project.toml exits 0.

CI on head f33569d, checked once after pushing: NonlinearSolveHomotopyContinuation Core (Julia 1 and LTS), QA, and the HomotopyContinuation downgrade job all pass. The SCCNonlinearSolve Core and CUDA jobs still fail; rack ci compare classed both as pre-existing before this fix, and this change does not touch those code paths. Several macOS jobs were still pending at the single check after pushing; I did not wait for the full suite.

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__NonlinearSolve.jl__1365 (no session URL)

`construct_jacobian_cache` stored the solver's residual array as the
`JacobianCache` output buffer, so every in-place AD Jacobian evaluation
overwrote the solver's `fu` with the dual-number primal of f(u). That
primal is not bitwise equal to a plain f call (e.g. `sin` of a Dual goes
through `sincos`), so the residual used by the step and the termination
check silently changed after each Jacobian evaluation. Use the cache's
own `fu_cache`, which is already allocated for DI preparation.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Agent-Harness: Claude Code
Agent-Model: claude-opus-5-5
Agent-Session: https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv
@ChrisRackauckas

Copy link
Copy Markdown
Member

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

Independent review (Devin CLI 3000.11.3, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium): MERGE, risk low.

Full review

VERDICT: MERGE
RISK: low

PR: #1365 (head 7dd4590, base origin/master 8a86577). No linked issue; stacked follow-up is #1367.

The change is one line: construct_jacobian_cache hands JacobianCache its private fu_cache instead of the caller's residual fu, so in-place DI.jacobian! stops overwriting the solver residual with the AD primal. fu_cache was already allocated and already used for DI preparation, so execution and preparation now see the same buffer. I checked every jac_cache(u) call site (FirstOrder step!, native bounded init/step, QuasiNewton TrueJacobianInitialization, arclength tangent, construct_extension_jac). None of them relies on the Jacobian call refreshing fu: each one evaluates f at the same u first (FirstOrder settles deferred residuals in refresh_residual! before the Jacobian). Line search and trust-region caches evaluate trial points into their own buffers. Running the probes below confirmed this.

Blocking findings

None.

Non-blocking findings

  1. The regression test depends on a ForwardDiff roundoff quirk (lib/NonlinearSolveBase/test/jacobian_private_fu.jl:16-21). It only detects the bug because sin(::Dual)'s primal differs from sin in the last bits. Confirmed by running: it fails on master (2 of 4 fail, fu == fu_plain) and passes on the PR. But if ForwardDiff/DI ever make the primal bitwise equal, the test passes on the buggy code too. A sentinel works for any backend: fill!(fu, 12345.0); jac_cache(u); @test all(==(12345.0), fu), plus @test jac_cache.fu !== fu. My probe scratch/probe_sentinel.jl does this. It fails on master and passes on the PR.
  2. The sparse path is affected but not tested. AGENTS.md asks for sparse prototype coverage. The change also covers the AutoSparse path (jac_prototype + SparseMatrixColorings). Confirmed by running: the sentinel probe passes on the PR for sparse jac_prototype with ForwardDiff and FiniteDiff, and J isa SparseMatrixCSC holds. It would cost little to loop the new test over a dense and a sparse case.
  3. The blast-radius section leaves out the extension solvers. construct_extension_jac (lib/NonlinearSolveBase/src/wrappers.jl:217) passes the extension's own resid buffer, which is LSO's y and FastLM's LMWorkspace residual. Confirmed by running scratch/probe_ext.jl: on master, calling the Jacobian at [3,4] overwrote resid with f([3,4]) = [8,15]. On the PR, resid is left alone. This is the same fix and it looks harmless. NLsolve (trust/newton), LeastSquaresOptim (lm/dogleg) and FastLevenbergMarquardt give identical retcodes, step counts and residuals on master and PR; FastLM differs only at roundoff. The PR body should still list it. (MINPACK errors with cfunction: closures are not supported on this platform on both master and the PR on this aarch64 Mac. That failure is pre-existing and not caused by this PR, but MINPACK went untested here.)
  4. The 98-configuration comparison table has no script or output attached. I could not rerun it as written. My independent 20-configuration subset matches its pattern (see What I ran): only dense in-place ForwardDiff cases differ, the differences are at roundoff, and retcodes and step counts are identical. My TR max per-iterate relative difference was 3.8e-11 against the body's 1.0e-13. That number is componentwise-relative and driven by near-zero entries; the final-u relative difference is 1.6e-16.
  5. The "Full suites on this branch" heading overstates the evidence: only the NonlinearSolveBase Core and QA groups were run. The "Not verified" section does say this.
  6. NonlinearSolveBase has no version bump. That matches the repo convention: git log -- lib/NonlinearSolveBase/Project.toml shows separate "Release NonlinearSolveBase vX" PRs.

What I ran

All runs used Julia 1.12.7, with two scratch envs built from git archive of origin/master and of the PR head. Both resolved to an identical Manifest; only the dev paths differ.

  • The author's test jacobian_private_fu.jl. On master: fails, fu == fu_plain false, the same output as the PR body. On the PR: 4/4 pass.
  • scratch/probe_sentinel.jl (fill fu with a sentinel, call the Jacobian, check fu is untouched). Master: fails on dense ForwardDiff. PR: passes dense FD, dense FiniteDiff, sparse-proto FD and sparse-proto FiniteDiff, and the sparse J stays SparseMatrixCSC.
  • scratch/probe_solvers.jl + compare.jl, run on master and PR. Problems: dense 100-dim IIP (A*u + 150 sin u - p) and IIP Rosenbrock. Algorithms: NR, NR+BackTracking, TR, LM, PseudoTransient, Broyden(true J), Klement(true J), NR+GMRES concrete J, default polyalg. Each configuration ran a step! loop that checked cache.fu == f(cache.u) bitwise after every step: 0 mismatches on the PR. Results: the dense IIP cases differ at roundoff (final-u rel ≤ 6.4e-14, which is LM; the others are ~1.6e-16), with identical retcode and nsteps. Rosenbrock and the default polyalg are bitwise identical. (Broyden+BackTracking hit a config error from my setup on both branches, so it is excluded.)
  • scratch/probe_ext.jl and scratch/probe_extsolve.jl: results as in non-blocking finding 3.
  • On the PR tree: GROUP=Core Pkg.test() for NonlinearSolveQuasiNewton passed, run from a scratch copy so nothing was written into the checkout. Test files run directly also passed: lib/NonlinearSolveFirstOrder/test/native_bounded_tests.jl (6006/6006), test/Core/arclength_jac_tests__item1.jl (43/43), lib/NonlinearSolveBase/test/extension_jac.jl (10/10), lib/NonlinearSolveQuasiNewton/test/core_tests__item12.jl (reinit with true-J init, 63/63).
  • Runic --check on the 3 changed files is clean. typos on the changed files is clean.

What I did not verify

  • The full NonlinearSolveFirstOrder Core group, SpectralMethods, the top-level NonlinearSolve test groups, and NonlinearSolveBase QA. I ran only the targeted files above, because of host limits.
  • Julia LTS/pre, GPU arrays, Enzyme/Mooncake/ReverseDiff backends, the PETSc/SIAMFANL/NLSolvers extensions, and MINPACK (which errors on this platform independently of the PR).
  • The PR body's allocation and timing table.

🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (review), 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-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 01a19739-725e-7912-a1dc-67463ce639e2, reviewed head 377c92a

  • Verdict: MERGE
  • Risk: medium-high (MH1: the shared core-package Jacobian path changes residual side effects and can consequently alter solver iterates and termination; this warrants a higher rating than a peripheral bug fix).
  • Round / slot: 1 / 1
  • Blocking priorities: none

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 retains the existing private residual workspace for repeated Jacobian evaluations, preventing AD from overwriting the solver residual. The added regression fails on the merge-base and passes at the reviewed live head; no blocking defect was found.

Blast radius: Array-valued JacobianCache construction in NonlinearSolveBase, particularly in-place differentiated residuals used by FirstOrder and default polyalgorithms; analytic, scalar, out-of-place, and operator Jacobian evaluation methods retain their computation paths.

Evidence: Blind assessment recorded and hashed before author context. Julia 1.13.2 regression: head 4/4 pass, exit 0; merge-base 2 pass/2 fail, exit 1, both failures at the exact residual-preservation assertion. The Jacobian oracle is analytic. CI covers Base Core, FirstOrder, polyalgorithms, AD, CUDA, and downstream integrations; the three failed jobs have matching failures on master as detailed below. G1, G2, and G3 have independent analytic, executed ForwardDiff, and repeated-buffer-preservation evidence respectively.

Blocking findings

None.

Non-blocking findings

None.

What I ran

Read-only inspection used git -C src diff origin/master...HEAD, the changed files and their callers, repository AGENTS.md, git -C src rev-parse HEAD, and git -C src merge-base origin/master HEAD. Inspected live metadata with gh pr view 1365 --repo SciML/NonlinearSolve.jl --json number,url,state,isDraft,headRefOid,baseRefName,baseRefOid; the PR is OPEN and draft, and its head matches TARGET. The API reports the Base recorded above; the fetched master tip is 8e21fb5, and the tested merge-base is the recorded Base. Fetched with git -C src fetch origin '+refs/pull/1365/head:refs/remotes/pr/1365' master and git -C src fetch origin '+refs/heads/master:refs/remotes/origin/master'. Used git -C src log -1 --no-merges --format=%B HEAD --not origin/master to extract author trailers from the newest non-merge PR commit, 7dd4590; merged master commits were excluded.

Julia invocations below use $SHARED_DEPOT for the supplied depot location. Every invocation used JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 JULIA_PKG_PRECOMPILE_AUTO=0 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$SHARED_DEPOT:" timeout 3600 julia +1.13.2 --startup-file=no; runs were sequential, on aarch64. Temporary environments and scripts are outside the source checkout. No registry update or package-wide test suite was run.

  • Head command: the common prefix above followed by tmp/head.jl. The script activated env, used Pkg.offline(true), developed the checked-out NonlinearSolveBase and SciMLJacobianOperators together, added ForwardDiff, ADTypes, SciMLBase, FiniteDiff, and SparseMatrixColorings, and included lib/NonlinearSolveBase/test/jacobian_private_fu.jl inside a testset. Exit 0: PR regression head | 4 4; Julia 1.13.2, 19.4 seconds for the testset.

  • Base command: the common prefix followed by --project=env-base tmp/base.jl. Exported the two local packages using git -C src archive dd8a550b79c4c9ea72a7b95b9233a34ffdb5bd8e lib/NonlinearSolveBase lib/SciMLJacobianOperators; copied the head environment with only those source paths redirected to the base export. Included the identical added head test against these unfixed sources. Exit 1: PR regression base | 2 2 4; both failures are fu == fu_plain at lib/NonlinearSolveBase/test/jacobian_private_fu.jl:20, with roundoff differences; both analytic Jacobian assertions pass. Testset time 21.3 seconds.

  • Independent probe command: the common prefix followed by --project=env tmp/probe.jl; exit 1, Independent residual ownership and analytic derivatives | 52 pass, 4 fail, 1 error, 57 total, 6.2 seconds. For a two-residual, three-unknown polynomial, all 42 assertions across dense ForwardDiff chunk sizes 1 and 2 and central FiniteDiff passed: construction and repeated evaluation preserve a sentinel residual, the workspace is distinct, and Jacobians match the independent analytic derivative after changes to both states and parameters. The reference was [[2p₁u₁, 3, 0], [u₂, u₁, 3p₂u₃²]]. A subsequent all-zero dense prototype was interpreted as an empty known sparsity pattern: four analytic comparisons returned a zero Jacobian, followed by ArgumentError: Batch size 2 larger than input size 1 during preparation of the next configuration. That preparation precedes the changed cache return at lib/NonlinearSolveBase/src/jacobian.jl:129. These prototype results were not reproduced on the base and are not claimed as PR regressions; the error prevented the remaining configurations from executing. No fourth Julia process or rerun was performed.

CI inspection used gh pr checks 1365 --repo SciML/NonlinearSolve.jl (exit 1 for three failed jobs), gh run view <ID> --repo SciML/NonlinearSolve.jl --log-failed, and gh run list --repo SciML/NonlinearSolve.jl --branch master --event push --limit 5, additionally filtering CI and SublibraryCI workflows and inspecting the merge-base runs. Redirected the GitHub CLI log cache to a writable temporary directory after its default cache was read-only.

  • PR Sublibrary CI: Base Core passes on stable, LTS, and prerelease; FirstOrder Core and QuasiNewton Core pass. SCC Core fails only isconcretetype(eltype(scc_sol_debug.original)) at lib/SCCNonlinearSolve/test/core_tests__item4.jl:100 (12 pass, 1 fail). Recent master Sublibrary CI, commit 85b0488, has the exact same assertion, evaluated solution type, and 12-pass/1-fail outcome. This is verified separately from a merely red workflow status.
  • PR top-level CI: both LTS Core jobs fail solve!() inference at test/Core/core_tests__item3.jl:27 (8 pass, 1 error). Merge-base master CI shows the same assertion and missing inferred solution return-code parameter on both operating systems. Stable Core, all PolyAlgorithms jobs, Adjoint jobs, and CUDA pass at the PR head. Latest master CI instead fails a CUDA assertion; it does not establish the LTS baseline.
  • PR IntegrationTest: ModelingToolkit, OrdinaryDiffEq, BoundaryValueDiffEq, and DiffEqCallbacks jobs pass. PR benchmarks, documentation, formatting, and Base QA checks pass.

What I did not verify

The independent probe did not reach its sparse-prototype or square-system cases, and did not validate the all-zero prototype case; the added square-system regression was verified separately on both revisions. Did not reproduce the author's 98-configuration comparison or timing/allocation measurements. Did not locally run whole-package, downstream, GPU, MPI, Reactant, or non-ForwardDiff AD suites, or Julia LTS and other operating systems; relevant CI statuses are distinguished above from local executions. No performance-only classification is assumed. The PR remains a draft; merge authorization and publication are the coordinator's responsibility.

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

@ChrisRackauckas-Claude
ChrisRackauckas-Claude marked this pull request as ready for review November 2, 2026 02:05
ChrisRackauckas and others added 3 commits November 7, 2026 23:03
Include the upstream return-code type assertion for polyalgorithm solve!,
which resolves the existing Julia 1.10 Core inference failure. Preserve the
private Jacobian residual workspace change.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.164.0
Agent-Model: gpt-6.1-sol
Agent-Session: local fixer job SciML__NonlinearSolve.jl__1365 (no session URL)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Muse <noreply@meta.com>
Agent-Harness: Muse CLI Code
Agent-Model: muse-wonder-full-1.0
Agent-Session: local fixer job SciML__NonlinearSolve.jl__1365 (no session URL)
TaylorDiff 0.3.5 fails to precompile with current Symbolics:
its code generation passes a Symbolics.Num through the ChainRules
tanh frule, which uses it in a boolean context. TaylorDiff 0.3.6
drops the Symbolics dependency and precompiles cleanly.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Muse <noreply@meta.com>
Agent-Harness: Muse CLI Code
Agent-Model: muse-wonder-full-1.0
Agent-Session: local fixer job SciML__NonlinearSolve.jl__1365 (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.

2 participants