Skip to content

Trace the nonlinear solver loops under Reactant - #1197

Draft
ChrisRackauckas-Claude wants to merge 63 commits into
SciML:masterfrom
ChrisRackauckas-Claude:reactant-jit-solve
Draft

ChrisRackauckas-Claude wants to merge 63 commits into
SciML:masterfrom
ChrisRackauckas-Claude:reactant-jit-solve

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

🚧 UNREVIEWED — awaiting review by @ChrisRackauckas. Filed by an AI agent running as @ChrisRackauckas; Chris has not seen this.
Harness: Codex CLI 0.170.0 · Model: gpt-6.2-astra
Conversation: local job 20261122T125333Z-codex-gpt-6.2-astra (no session URL)

Summary

Makes Moré TrustRegion / first-order paths Reactant-traceable with one host implementation (within_compile gates, maybe_traced / select / ifelse, @trace loops). Compiled solves match host retcodes or throw explicitly; store-inverse QN first-step invert restored under compile; host AbsNorm / Diagonal ill-conditioning semantics unchanged.

SciMLBase ≥ 3.57 (ConcreteEnum retcode carrier). NonlinearSolveBase 2.55.0 (above master 2.54.1). DifferentiationInterface ≥ 0.7.4 (public AutoForwardFromPrimitive). Reactant SciMLBase pin removed.

Array AD Jacobians under @jit: ArgumentError before DI prepare when a concrete AD Jacobian is needed without analytic jac (DI#1067). Scalar AD derivatives work under compile; default backend is AutoForwardFromPrimitive(AutoEnzyme Forward) (explicit raw AutoEnzyme also works for some scalar solves). Krylov / Jacobian-operator linear solves are not supported under compile.

SCC note: sols_buffer_eltype in this PR overlaps #1332; leave until #1332 merges, then resolve the next master merge to master's version.

Round-5 follow-up (8cf0e5f4)

  • Tutorial Reactant Newton example now supplies analytic jac; covered by Reactant testset named after docs/tutorials/nonlinear_solve_gpus.md.
  • Qualified AutoEnzyme wording: prefer AutoForwardFromPrimitive by default; raw AutoEnzyme is not claimed unusable on scalar paths.

Limitations

  • Traceable DFSane / non-monotone line search under Reactant → LineSearch.jl.
  • SafeBest under compile — documented, not reimplemented.
  • Broyden + explicit AD line search under compile — fails loudly; documented.
  • Array AD Jacobian under @jit blocked until DI#1067; analytic jac required.
  • Krylov / Jacobian-operator linear solves unsupported under compile.

CI triage

Master merged at 1caff340 (master 0055e314, includes #1344, #1352, #1321, #1357, #1356). Master's fixes for the earlier master-also failures (Base QA implicit_sensitivity_solve, FO QA RobustTrustRegionLinsolve, FO Core Enzyme/SVector) are now in this branch; CI on 1caff340 has not been read yet.

Job Cause Status
Benchmark LTS Resolve needs NonlinearSolveBase 2.55.0 registered (registry at 2.54.1) Release prerequisite
Core LTS / Downgrade Core inference SciMLBase 3.57 solve! inference, also on master's LTS jobs master-equivalent floor raise

Master merge 1caff340 (conflict resolutions)

  • lib/NonlinearSolveBase/Project.toml, lib/NonlinearSolveFirstOrder/Project.toml: kept the PR's SciMLBase = "3.57", took master's SciMLJacobianOperators = "0.1.20".
  • lib/NonlinearSolveBase/test/qa/qa.jl: union of both ignore lists (master's implicit_sensitivity_solve + the PR's ReactantCore is_traced).
  • Not a conflict: SciMLJacobianOperators bumped 0.1.20 → 0.1.21, since the PR changes its source (T <: Number) and master already took 0.1.20.
  • All master-side deltas in the auto-merged files (autodiff.jl, NonlinearSolveBase.jl, SCCNonlinearSolve.jl, SciMLJacobianOperators.jl, both runtests.jl, devdocs) are present unchanged. Every package version stays above master's. Polyalgorithm solve!: assert retcode type for Julia 1.10 inference #1347 and Fix polyalgorithm init+solve! for Simple*/NoInitCache sub-caches (#1348) #1349 are not on master yet.

Verification (head 1caff340)

Runic --check (41 .jl files changed vs master) → exit 0
typos (all files changed vs master) → exit 0
GROUP=Core julia --project=lib/NonlinearSolveBase -e 'using Pkg; Pkg.test()'
  → 548/548 pass, "Testing NonlinearSolveBase tests passed", EXIT=0
GROUP=Core julia --project=lib/NonlinearSolveQuasiNewton -e 'using Pkg; Pkg.test()'
  → 1066/1066 pass, "Testing NonlinearSolveQuasiNewton tests passed", EXIT=0
GROUP=Reactant julia --project -e 'using Pkg; Pkg.test()'
  → Reactant Integration | 178 178 18m46.0s, "Testing NonlinearSolve tests passed", EXIT=0

Not run locally, left to CI: FirstOrder Core, QA groups, docs build, the full suites, LTS/downgrade.

Risk assessment

pending independent review

🤖 Generated with Cursor Agent CLI 2026.10.01-14929f9 (model: auto), session c1431384-7d7b-4422-930d-5a27d9d0a0c0

Master merge validated by Claude Code 2.1.292 (model: opus); transcript at /log.txt

Master merge a6944361

Master (dd8a550b, incl. #1371, #1373, #1329) registered NonlinearSolveBase 2.55.0 and SCCNonlinearSolve 1.16.0, so the PR's versions move above them:

  • lib/SCCNonlinearSolve/Project.toml (only conflict): 1.15.5 vs master 1.16.0 → 1.16.1.
  • NonlinearSolveBase → 2.56.0; the PR's NonlinearSolveBase = "2.55" lower bounds (root, FirstOrder, QuasiNewton, SpectralMethods) → "2.56". The Benchmark LTS item above now needs 2.56.0 registered.
  • Keep spelled NonlinearSolution element type concrete across SciMLBase layouts #1332 is still open, so the PR's sols_buffer_eltype stays.

Verification on a6944361 (Julia 1.13.0): NonlinearSolveBase GROUP=Core → 548/548, "tests passed"; SCCNonlinearSolve GROUP=Core → "tests passed"; root Pkg.resolve() picks NonlinearSolveBase 2.56.0 from the path source; typos clean on changed files. Not rerun: Reactant, FirstOrder/QuasiNewton Core, QA, docs.


🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5
Conversation: local session ID 97e6aedd-09fb-48d4-baf1-1648f690f988 (headless, no URL)

Re-review round 2 fixes (247d608f)

These are the two P1 findings from the Codex Sol re-review of a6944361. Both reproduced locally first: Julia 1.13.0, Reactant 0.2.293, ReactantCore 0.1.26, Enzyme 0.13.216, SciMLBase 3.58.0, LinearSolve 5.18.2.

  1. Compiled store-inverse Broyden inverted a general Jacobian elementwise. The compile branch of linsolve_identity!! now solves A X = I with SciMLBase.solve(LinearProblem(A, I)). LinearSolve's Reactant overlay runs that as a host callback with the default algorithm, so the result, including the singular-matrix rescue, matches the host workspace path. I tried Reactant's native inv(::TracedRArray) and A \ B with a matrix RHS first. On a 2×2 Float32 matrix both hung for more than 15 minutes in the MLIR ConcatViewCSE rewrite pass, so the branch does not use them.
    • Reviewer's case (A = [2 1; 1 3], maxiters = 1): compiled [-2.0, -1.6666667] before the fix, [0.19999993, 0.6] Success after, the same as the host result.
    • New Reactant testset "Broyden true_jacobian coupled Jacobian under compile" (coupled A*u + u.^3/10 - p, analytic jac, maxiters ∈ (1, 50), compared against host). It fails on the unfixed code: Evaluated: Float32[-2.0130434, -1.7363636] ≈ Float32[0.26707137, 0.585736] (rtol=0.001). It passes with the fix: 2/2 + 2/2.
  2. Reactant.@compile of TrustRegion() failed with "Types do not match between function arguments and results". The cause is in _more_update_λ: its safeguarded fallback l + 0.01 * (u - l) uses a Float64 literal. Reactant 0.2.293 promotes TracedRNumber{Float32} * Float64 to Float64, so the loop-carried λ changed type inside the traced Moré loop. I found this by printing the carried types before and after one iteration of _more_generic_λloop!: only λ changed, TracedRNumber{Float32} → TracedRNumber{Float64}. The literal now takes λ's type (oftype(λ, 0.01)).
    • On the host this changes one thing: a Float32 λ no longer becomes Float64 on that fallback branch. Float64 results are bit-identical.
    • New Base Core test "Moré λ update keeps its type". It fails on the unfixed code (Evaluated: 0.01 isa Float32, Evaluated: 0.01 == 0.01f0) and passes with the fix (10/10). The existing Reactant assertion at test/Reactant/reactant_tests.jl:80 (compile solve_trust_region) is the end-to-end fail-before. With the fix the compiled solve returns [1.4142135, 1.4142135] Success.

New limitation: under compile, the store-inverse initial inverse runs on the host through LinearSolve's Reactant callback. It needs LinearSolve loaded, which NonlinearSolve does, and it is a host round-trip on device backends. This happens once per Jacobian (re)initialization.

Verification (head 247d608f, Julia 1.13.0, JULIA_NUM_THREADS=4)

Runic --check (5 changed .jl files) → exit 0;  typos (changed files) → clean
GROUP=Core  lib/NonlinearSolveBase         → 558 pass, "Testing NonlinearSolveBase tests passed"
GROUP=Core  lib/NonlinearSolveFirstOrder   → 8971 pass, "Testing NonlinearSolveFirstOrder tests passed"
GROUP=Core  lib/NonlinearSolveQuasiNewton  → 1066 pass, "Testing NonlinearSolveQuasiNewton tests passed"
GROUP=Reactant julia --project -e 'using Pkg; Pkg.test()'
  → Reactant Integration | 182 182 8m22.2s, "Testing NonlinearSolve tests passed"

Not run locally: QA groups (no public API, exports, or deps changed in this commit), docs build, LTS/downgrade, GPU, downstream.

Breaking change

No public API is removed, renamed, or changed in signature or behavior. The bumps this PR requires are already on the branch:

  • minor for NonlinearSolveBase (2.56.0: new public helpers and new deps)
  • minor for NonlinearSolve (4.33.0)
  • patch for every other changed sublibrary

No major bump is required.


🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5
Conversation: local session ID 97e6aedd-09fb-48d4-baf1-1648f690f988 (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 6363472)

Merged current upstream normally, including the Julia 1.10 polyalgorithm retcode-inference correction. The first-order conflict resolution retains tracing and applies upstream's forcing update after the accepted residual is available. Opaque SCC callbacks receive adapter-compatible solution views, while explicit concrete wrapper signatures retain concrete buffers. Traced scalar and array copies preserve their input types, preventing Boolean cache fields from becoming integers.

Failing-before / passing-after

  • Julia 1.10 inference: the existing test passed solve() 8/8, then errored in solve!() with an incompletely inferred retcode carrier. After the merge, both testsets pass 8/8. They also pass with the declared minimum SciMLBase 3.57.0.
  • SCC forwarding adapters: the new homogeneous and mixed closure cases error before the fix with a SubArray conversion MethodError. The legacy-signature testset changes from 13 pass / 1 error to 19/19 pass; the complete SCC Core group passes 93 assertions.
  • Traced Boolean copies: both new cases error before the fix:
TypeError: in typeassert, expected Reactant.TracedRNumber{Bool}, got a value of type Reactant.TracedRNumber{Int64}
TypeError: in typeassert, expected Reactant.TracedRArray{Bool, 1}, got a value of type Reactant.TracedRArray{Int64, 1}

Both cases pass in the completed 184/184 Reactant matrix after the fix.

Local verification

All runs used JULIA_NUM_THREADS=4, OPENBLAS_NUM_THREADS=1, and JULIA_PKG_PRECOMPILE_AUTO=0. Environment locations are represented by variables below. $LTS_ENV develops the checkout and its in-tree dependencies; $validation_env selects each package's native project.

julia +1.10 --compiled-modules=no --project="$LTS_ENV" -e 'using Test; include("test/Core/core_tests__item3.jl")'
GROUP=Core timeout 3600 julia +1.10 --compiled-modules=no --project="$LTS_ENV" -e 'using Pkg; Pkg.test("NonlinearSolve")'
GROUP=Core timeout 3600 julia +1.10 --compiled-modules=no --project="$LTS_ENV" -e 'using Pkg; Pkg.test("SCCNonlinearSolve")'
GROUP=Core timeout 3600 julia +1.13.0 --compiled-modules=existing --project="$validation_env" -e 'using Pkg; Pkg.resolve(); Pkg.test()'
GROUP=QA timeout 3600 julia +1.12.7 --compiled-modules=existing --project="$validation_env" -e 'using Pkg; Pkg.resolve(); Pkg.test()'
GROUP=Reactant timeout 3600 julia +1.13.0 --compiled-modules=existing --project -e 'using Pkg; Pkg.resolve(); Pkg.test()'

The Julia 1.13 Core command covered FirstOrder and Base; the QA command covered root, SCC, FirstOrder, and Base. Core counts below sum the printed top-level test summaries.

Group Package Passing assertions
Core, Julia 1.10.12 NonlinearSolve 1080
Core, Julia 1.10.12 SCCNonlinearSolve 93
Core, Julia 1.13.0 NonlinearSolveFirstOrder 9028
Core, Julia 1.13.0 NonlinearSolveBase 574
QA, Julia 1.12.7 NonlinearSolve 28
QA, Julia 1.12.7 SCCNonlinearSolve 20
QA, Julia 1.12.7 NonlinearSolveFirstOrder 20
QA, Julia 1.12.7 NonlinearSolveBase 20
Reactant, Julia 1.13.0 NonlinearSolve 184

Selected tails of the real outputs:

FastShortcutHomotopyPolyalg + homotopy initialization_alg |   12     12  15.2s
 15.228141 seconds (18.27 M allocations: 1.304 GiB, 1.74% gc time, 99.76% compilation time)
     Testing NonlinearSolve tests passed 

Test Summary:                                      | Pass  Total  Time
Legacy ten-parameter FunctionWrapper SCC signature |   19     19  0.8s
     Testing SCCNonlinearSolve tests passed 

Test Summary:           | Pass  Total  Time
SciMLOperator Jacobians |   14     14  5.4s
     Testing NonlinearSolveFirstOrder tests passed 

Test Summary:                        | Pass  Total  Time
Dense LU refactorization allocations |   14     14  1.7s
     Testing NonlinearSolveBase tests passed 

Test Summary: | Pass  Total     Time
QA            |   28     28  2m27.4s
     Testing NonlinearSolve tests passed 

Test Summary: | Pass  Total     Time
QA            |   20     20  1m38.0s
     Testing SCCNonlinearSolve tests passed 

Test Summary: | Pass  Total     Time
QA            |   20     20  2m27.0s
     Testing NonlinearSolveFirstOrder tests passed 

Test Summary: | Pass  Total   Time
QA            |   20     20  32.1s
     Testing NonlinearSolveBase tests passed 

Test Summary:        | Pass  Total     Time
Reactant Integration |  184    184  9m49.5s
590.013861 seconds (642.36 M allocations: 34.086 GiB, 1.30% gc time, 81.37% compilation time: 3% of which was recompilation)
     Testing NonlinearSolve tests passed 

Formatting and spelling:

julia +1.13.0 --compiled-modules=existing --project=@runic -m Runic --inplace lib/NonlinearSolveBase/src/reactant.jl test/Reactant/reactant_tests.jl lib/SCCNonlinearSolve/src/SCCNonlinearSolve.jl
xargs -r -d '\n' julia +1.13.0 --compiled-modules=existing --project=@runic -m Runic --check < "$JULIA_FILES"
git diff HEAD --unified=0 | python3 -c 'import sys; print("".join(x[1:] for x in sys.stdin if x.startswith("+") and not x.startswith("+++")),end="")' | typos - --format brief
git diff --check

These ran before committing. Runic checked all 37 changed Julia files; all four checks exited 0 with empty output. The initial FirstOrder scratch-context attempt stopped before tests because of relative [sources] resolution; the native-project retry above passed.

Remaining blockers and limits

ReactantCore.is_traced remains non-public; an upstream public interface is still required. The PR's hard dependencies ReactantCore and ConstructionBase both have MIT licenses.

The docs build fails during TaylorDiff loading with TypeError: non-boolean (Symbolics.Num) used in boolean context. A separate clean-master investigation reproduced it and isolated ChainRules 1.74.10 (standalone import passes) versus 1.74.11 (fails), with manifests differing only in ChainRules. The introducing commit is linked below. The Julia 1.13 docs attempt entered recursive exception rendering and was stopped; Julia 1.12.7 exposed the underlying baseline error. No baseline dependency workaround was added.

Not verified: macOS execution, the full all-dependency downgrade environment, benchmarks, GPU, downstream packages, or Everything. The minimum SciMLBase inference case was verified. CI completion is not claimed.

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__NonlinearSolve.jl__1197 (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 bdb22e4)

The two base-green failures (lib/NonlinearSolveHomotopyContinuation Core and QA on Julia 1, plus the same failure on LTS and in downgrade-sublibraries) were a TaylorDiff precompile failure, not a solver test failure:

ERROR: LoadError: TypeError: non-boolean (Symbolics.Num) used in boolean context
  [1] derivatives_given_output(Ω::Symbolics.Num, ::typeof(tanh), x::Symbolics.Num)
    @ ChainRules .../rulesets/Base/fastmath_able.jl:42
  [3] get_term_raiser(func::Function) @ TaylorDiff .../utils.jl:56
Failed to precompile TaylorDiff

Root cause: ChainRules (1.74.13 in the failing runs, 1.74.8 in the last passing HomotopyContinuation run) changed its tanh scalar rule to branch on the input (abs(real(x)) < 1 ? 1 - Ω^2 : sech(x)^2). TaylorDiff 0.3.5 evaluates that frule on a Symbolics.Num during its own precompilation, which now throws. This reproduces with no NonlinearSolve code involved: a scratch environment containing only TaylorDiff 0.3.5 + ChainRules 1.74.13 + Symbolics 7.48.0 fails to load TaylorDiff, and the same environment at TaylorDiff 0.3.6 loads. TaylorDiff 0.3.6 takes its derivative expressions from DiffRules instead of evaluating ChainRules rules symbolically.

Change: lib/NonlinearSolveHomotopyContinuation/Project.toml compat floor TaylorDiff = "0.3.1" → "0.3.6", so no resolver (including downgrade runs, which resolved TaylorDiff 0.3.5 in the failing CI) can select the broken combination. The HomotopyContinuation sublibrary version on this branch (0.1.14) is already above master's, so no further bump was needed. No solver code changed; no test was added because the existing HomotopyContinuation Core/QA suites are the failing-before/passing-after check for a compat floor.

Failing-before / passing-after evidence (Julia 1.13.2, JULIA_NUM_THREADS=4):

# TaylorDiff 0.3.5 + ChainRules 1.74.13 + Symbolics 7.48.0, scratch env:
julia -e 'using TaylorDiff'
EXIT:1
ERROR: LoadError: TypeError: non-boolean (Symbolics.Num) used in boolean context
Failed to precompile TaylorDiff [b36ab563-344f-407b-a36a-4f200bebf99c] (ProcessExited(1)).

# Same env at TaylorDiff 0.3.6:
EXIT:0
loaded OK 0.3.6

# With the new compat floor, pinning 0.3.5 alongside the sublibrary is rejected:
Pkg.develop(path="lib/NonlinearSolveHomotopyContinuation"); Pkg.add(TaylorDiff 0.3.5)
EXIT:1
ERROR: Unsatisfiable requirements detected for package TaylorDiff [b36ab563]:

Validation commands and real output tails:

GROUP=Core julia --project=lib/NonlinearSolveHomotopyContinuation -e 'using Pkg; Pkg.test()'
EXIT:0
AllRoots      |  116    116  1m07.5s
Single Root   |   35     35  43.7s
Taylor Polynomialize |   40     40  1m02.9s
     Testing NonlinearSolveHomotopyContinuation tests passed

GROUP=QA julia --project=lib/NonlinearSolveHomotopyContinuation -e 'using Pkg; Pkg.test()'
EXIT:0
QA            |   19       1     20  32.7s
     Testing NonlinearSolveHomotopyContinuation tests passed

typos lib/NonlinearSolveHomotopyContinuation/Project.toml  → exit 0
Runic: not applicable, the only changed file is a Project.toml (no .jl files changed).

Not verified locally: Julia LTS and the downgrade-sublibraries lane (left to CI; TaylorDiff 0.3.6 declares julia = "1.10" compat), the rest of the PR's test groups (unchanged by this commit), and the checks rack ci compare classes as pre-existing or no-base (CUDA, Documentation, benchmark LTS, downgrade-sublibraries signature on the base run).

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__1197 (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.170.0 gpt-6.2-astra (head 8e7e5d5)

Merged current master, preserving the published branch history. The LTS benchmark now resolves each checkout's runtime path dependencies in one Pkg operation. The project that AirspeedVelocity copies into the runner shares that resolution. A regression test checks that Base, QuasiNewton and the transitive SciMLJacobianOperators dependency come from the checkout.

Verification

On Julia 1.10.12 the unmodified master benchmark dependency setup resolved NonlinearSolveBase 2.55.1 and NonlinearSolveQuasiNewton 1.15.3. The following command used the same PR source revision with the two benchmark drivers. Environment and output locations are represented by variables.

julia --startup-file=no --project="$TOOLS_ENV" -e 'include("benchmark/ci.jl"); results = benchmark_revisions(ENV["CHECKOUT"], [ARGS[1]], ENV["OUTPUT"]); @assert !isempty(results)' bdb22e4ac228f2ae09e223ca0e2fa4d976214c51

Before, the process exited 1.

ERROR: Unsatisfiable requirements detected for package NonlinearSolveBase [be0214bd]:
 NonlinearSolveBase [be0214bd] log:
 ├─possible versions are: 1.0.0-2.55.1 or uninstalled
 └─restricted to versions 2.56.0-2 by NonlinearSolveQuasiNewton [9a2c21bd] — no versions left

After, the same benchmark revision resolved Base 2.56.0 and wrote 17 results, including package load time. Exit 0.

[ Info:     Benchmark runner exited.
[ Info:     Finished.
julia +lts --startup-file=no --project="$TOOLS_ENV" benchmark/test_sources.jl
# LTS benchmark project resolves checkout sources after copying |    3      3  11.6s

GROUP=QA julia +1.13.3 --startup-file=no --compiled-modules=existing --project -e 'using Pkg; Pkg.test()'
# QA            |   28     28  2m30.7s
#      Testing NonlinearSolve tests passed

GROUP=Reactant julia +1.13.3 --startup-file=no --compiled-modules=existing --project -e 'using Pkg; Pkg.test()'
# Reactant Integration |  184    184  16m08.0s
#      Testing NonlinearSolve tests passed

xargs -0 julia +1.13.3 --project=@runic -m Runic --inplace < "$JULIA_FILES"
xargs -0 julia +1.13.3 --project=@runic -m Runic --check < "$JULIA_FILES"
git diff --name-only -z "$BASE" HEAD | xargs -0 typos
git diff --check "$BASE" HEAD
# exit 0, no output

From a clean checkout of the final commit, the full LTS workflow compared master and the fix, wrote timing and memory tables, and produced identical sets of 17 benchmark cases. The SCC Core suite also passed on both Julia versions where the master push failed. The SCC environments used the checkout's sublibraries and its declared test dependencies.

julia --startup-file=no --project="$TOOLS_ENV" benchmark/ci.jl cee51ef679e989d2d2868ebb9d259e7163e87c5a 8e7e5d519b3b6cd80c95dfd78eec2fa6e939850c "$OUTPUT"
# | time_to_load                                  | 0.155 k allocs: 16.4 kB   | 0.155 k allocs: 16.4 kB   | 1                                     |

GROUP=Core julia +lts --compiled-modules=no --startup-file=no --project="$SCC_TEST_ENV" lib/SCCNonlinearSolve/test/runtests.jl
# Legacy ten-parameter FunctionWrapper SCC signature |   19     19  1.5s
# 93 passing assertions across the group on Julia 1.10.12

GROUP=Core julia +1.13.3 --startup-file=no --compiled-modules=existing --project="$SCC_TEST_ENV" -e 'include("lib/SCCNonlinearSolve/test/runtests.jl")'
# Legacy ten-parameter FunctionWrapper SCC signature |   20     20  1.5s
# 95 passing assertions across the group on Julia 1.13.3

The documentation build exited 0 in a clean checkout. Documenter produced the HTML index.

julia +1.13.3 --compiled-modules=existing --project=docs -e 'using Pkg; Pkg.instantiate()'
julia +1.13.3 --compiled-modules=existing --project=docs docs/make.jl
# Warning: Documenter could not auto-detect the building environment. Skipping deployment.

CI comparison and scope

The preceding head's Sublibrary CI completed with 47 successful jobs and three matrix skips. The LTS benchmark was the non-GPU failure. The PR CUDA job and master CUDA job both ran on GPU hardware. Each recorded 21 passes and one failure when CUDACore accessed the deprecated GPUCompiler.compile_hook binding. The default-branch CUDA and SCC failures have existing tracking.

No local GPU, macOS, downgrade, or Everything run in this fix session. The earlier review item for a public ReactantCore.is_traced API still depends on upstream exposing that predicate.

Next counted review must come from a smart model in a fresh session, not this fix session.

CI triage (CUDA check, pre-existing on master)

The failing tests / CUDA (julia 1, self-hosted Linux X64 gpu) / Tests - CUDA (Julia 1) check is not introduced by this PR: the same job fails on master itself (workflow run for master CI (NonlinearSolve), conclusion failure at 2026-11-22; the master run id observed: 44568335433). The failing test is the GeneralizedFirstOrderAlgorithm warning-capture assertion (1 failed of 22 CUDA tests), which fails identically on the pre-rebase head.

Non-GPU checks on this head are green or in progress. This note is evidence for the merge gate, per the repo's practice of naming failures that also fail on the default branch.


🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a20351-c92f-7a63-9f2c-190beb8b0e01 (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.170.0 gpt-6.2-astra (head 97a1fda)

Rejected trust-region trials now preserve both the iterate and the residual. Tracing rejects active Jacobian reuse and explicit matrix linear solvers whose callbacks discard failure status. Least-squares fallback uses a scaled L2 norm. Diagonal quasi-Newton uses the selected initializer, zero-safe inversion and exact singularity checks. Compiled safe-best termination retains the best iterate, and explicit plain-norm termination continues after a nonfinite residual. The traced-cache helper uses the public scalar promotion API, and the public-access QA check covers it.

The exp(u) + 1 regression returns the Float32 three-step Newton iterate near -20.464836 with MaxIters on both backends. The ill-conditioned diagonal system reaches [1, 100000] with Success. The DFSane diagnostic and tutorial describe the solver integration required for the traced LineSearch implementation.

Regression evidence

On the starting head, the corrected trust-region, reuse, explicit LU and fallback tests recorded nine failed assertions. The four diagonal cases recorded seven failures and one error. The termination tests recorded six failures. Restoring the public-access check on the starting code raised NonPublicQualifiedAccessException for ReactantCore.is_traced.

The four baseline runs reported these pass, fail and error counts.

Review reproductions              | 14  9        23  1m24.2s
Baseline diagonal and reset checks | 12  7  1     20  1m27.0s
termination                       |  6  6        12  1m15.1s
QA                                | 19     1     20  1m30.1s

The stock two-thread rerun on Julia 1.13.3 loaded first_order_tests.jl, linear_tests.jl, polyalgorithm_tests.jl, diagonal_tests.jl and termination_tests.jl from the Reactant test group.

Reviewed solver reproductions |   55     55  2m48.0s

The full integration group also exposed a scalar indexing error when the default solver visited a Julia vector of traced scalars. Both the focused buffer test and the existing scalar default integration test raised a scalar-indexing exception before the storage fix.

A one-thread stock rerun after the buffer correction reported the following.

Julia buffer of traced scalars |    1      1  6.2s
Scalar solve regression |    9      9  1m23.8s

ReactantCore 0.1.27 also treats a bare nothing as an uninitialized loop variable. The no-op step observer and optional Moré scaling have concrete loop representations during compilation. The rejected trust-region regression raised UndefVarError: dtd not defined in local scope on 0.1.27 before the scaling fix. The same 55 regressions subsequently passed on 0.1.27, and all nine first-order regression assertions also passed on 0.1.26.

The cold stock four-thread run used the root command below. It deadlocked with the caller in XLAExecuteSharded and the callback in jl_gc_wait_for_the_world. I stopped the process after collecting the stacks. The final one- and two-thread result-transfer runs showed the same wait.

GROUP=Reactant JULIA_NUM_THREADS=4 julia +1.13.3 --startup-file=no --compiled-modules=existing --project=. -e 'using Pkg; Pkg.test()'

To exercise every solver assertion, I repeated the root group on byte-identical solver sources with a diagnostic copy of Reactant 0.2.308 that marks its two blocking PJRT calls GC-safe. With ReactantCore 0.1.27, the group completed:

GROUP=Reactant JULIA_NUM_THREADS=4 julia +1.13.3 --startup-file=no --compiled-modules=existing --project="$QA_ENV" test/runtests.jl
Test Summary:        | Pass  Total      Time
Reactant Integration |  240    240  11m44.7s

The diagnostic dependency change lives outside the PR. On stock Reactant, the starting head completed its original integration suite on one and two Julia threads, and all 55 focused review assertions passed on both ReactantCore 0.1.26 and 0.1.27. The stock four-thread full-suite result on the final head remains blocked.

Validation

The groups used their checked-in runtests.jl entry points and environments containing the local subpackages and declared test dependencies. JULIA_NUM_THREADS=4 and OPENBLAS_NUM_THREADS=1 unless specified.

GROUP=QA julia +1.13.3 --startup-file=no --compiled-modules=existing --project=. -e 'using Pkg; Pkg.test()'
GROUP=QA julia +1.13.3 --startup-file=no --compiled-modules=existing --project="$QA_ENV" "lib/$pkg/test/runtests.jl"
GROUP=Core julia +1.13.3 --startup-file=no --compiled-modules=existing --project="$TEST_ENV" "lib/$pkg/test/runtests.jl"
GROUP=Core julia +1.10 --startup-file=no --compiled-modules=no --project="$TEST_ENV" "lib/$pkg/test/runtests.jl"
julia +1.13.3 --startup-file=no --compiled-modules=existing --project=docs docs/make.jl
julia +1.13.3 --project=@runic -m Runic --inplace "${changed_julia_files[@]}"
julia +1.13.3 --project=@runic -m Runic --check "${changed_julia_files[@]}"
git diff -U0 8e7e5d519 -- | sed -n '/^+++ /!s/^+//p' | typos -
git diff --check 8e7e5d519
root QA                       | 28  28
NonlinearSolveBase QA         | 20  20
NonlinearSolveFirstOrder QA   | 20  20
SCCNonlinearSolve QA          | 20  20
Core testset totals              Julia 1.13.3   Julia 1.10.12
NonlinearSolveBase                  574/574         561/561
NonlinearSolveFirstOrder          9028/9028       9612/9612
NonlinearSolveQuasiNewton         1078/1078       1411/1411

The docs build wrote the HTML site and the version 4.33.0 inventory. Runic, typos and the diff check exited 0. Julia 1.10 expanded all 11 traced blocks in the changed implementation files with ReactantCore 0.1.21.

Remaining external finding

The CPU hang reproduces in a clean project importing only Reactant 0.2.308 and InteractiveUtils. A Julia callback requests GC during a host result transfer. The result reader blocks in FutureAwait → BlockUntilReady while the collector waits in jl_gc_wait_for_the_world. A cold four-thread solver run showed the same GC wait with the caller in XLAExecuteSharded. This occurred with both ReactantCore 0.1.26 and 0.1.27. The standalone program, versioninfo and debugger stacks are available to the head session for upstream reporting. No upstream issue was filed.

The cubic Klement failure example returns ConvergenceFailure on both backends. Default XLA Float32 arithmetic produces a different residual even at an identical first iterate, and subsequent failed iterates differ. In a separate diagnostic run, disabling backend optimization matched the host iterate and residual exactly. The solvable diagonal regression above uses default optimization.

The CUDA warning assertion also fails on the default branch. GPU and downstream tests were not run locally. Default-branch CUDA run and existing tracking issue.

Next counted review must come from a smart model in a fresh session, not this fix session.


🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a2083d-5ca4-7700-8319-fe7ea2c76de2 (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.170.0 gpt-6.2-astra (head 7c40845)

The focused host/compiled regressions on the reviewed commit reported 57 passed, 24 failed, 3 errored. The HLO, cyclic graph and matrix-option checks were also replayed separately. Each behavioral assertion below uses host results, known roots or a hand-computed Newton step.

Regression Reviewed commit 97a1fda0b Revised behavior
1. Aliased polyalgorithm members First success returned u=3, resid=0, although f(3)=6. With two failures it returned u=4, resid=2, although f(4)=12. The retained point, caller buffer, residual and return code agree with the host. First success gives (0,0,Success). The best failure gives (2,2,MaxIters). Both cases passed 8/8.
2. Public Newton step With either iteration limit, the compiled step returned (0,-2,1). Limits 1 and 0 give the hand-computed (1.5,0.25,1) and (1,-1,0) respectively. All 12 assertions passed.
3. Failed initializer Newton advanced to (2,0,Success) and incremented the step counter. Newton, cached polyalgorithm and no-init drivers preserve (3,1,InitialFailure). All three leave the Jacobian evaluation count at zero. Both caches with step counters keep them at zero. All 30 assertions passed.
4. Matrix solve The cold tutorial HLO contained reactant_julia_callback. A baseline replay captured the callback in jl_gc_wait_for_the_world while the caller waited in BlockUntilReady. The baseline process required termination. The tutorial passed 4/4 in a fresh process with normal GC. Its HLO has no Julia callback, both materialized roots agree with sqrt(2.0f0), and the maximum absolute materialized residual is at most 1f-5.
5. Exact endpoint return codes Both exact codes fell through to the second member and returned (1,Success). Each preserves the first root 0 and its exact left/right code (8/8 each). StalledSuccess still tries the next member (8/8).
6. Const parameter fields Newton threw setfield!: const field .value of type FrozenParam cannot be changed. Copying the cyclic fixture also failed. The host and compiled solves both return ([2],[0],Success). The caller retains the same field object and value (5/5). Shared references and cycles point into the correct graph and mutating the copy preserves the original (5/5).
7. Combined norm Compiling the short-circuit predicate raised a traced-Boolean TypeError. The absolute-only test stops at step 1 and the relative-only test at step 2. Both agree with host Success (4/4).
Box bounds Broyden on the host found 2. Compilation reached a traced-Boolean error in clamping. The bounds transformation raises an actionable ArgumentError during compilation. The host still finds 2 (3/3). The tutorial documents this limit.
Default host TrustRegion Case 233 of 500 seeded Float32 systems changed from 0.040142298f0 on master to 0.040142417f0 on the reviewed head. The direct fallback returned 0.01f0. All 500 host results, including return codes, match the independent master output byte for byte. The default host fallback returns Float64(0.01); traced damping retains the loop variable's element type.

The reviewed head compiled a custom matrix configuration (maxiters=10) without an exception. The revised test passed both the host root and the actionable compile-time error check. Dense defaults lower to a device-side SVD, including the inverse-Jacobian solve with a matrix right-hand side. Custom matrix solvers and unsupported options direct users to host execution.

The two comments in the Moré and Levenberg–Marquardt implementations now describe their control flow in the present tense.

Local verification

The CPU runs used normal garbage collection, four Julia threads, four precompile tasks and one OpenBLAS thread. The test environments resolved Reactant 0.2.309, ReactantCore 0.1.27 and GPUCompiler 2.10.0.

export JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=4 OPENBLAS_NUM_THREADS=1 JULIA_PKG_PRECOMPILE_AUTO=0
NONLINEARSOLVE_TEST_GROUP=Reactant julia +1.12.7 --compiled-modules=existing --startup-file=no --project=. -e 'using Pkg; Pkg.test()'
NONLINEARSOLVE_TEST_GROUP=Reactant julia +1.13.3 --compiled-modules=existing --startup-file=no --project=. -e 'using Pkg; Pkg.test()'
GROUP=Core julia +1.12.4 --compiled-modules=existing --startup-file=no --project=. -e 'using Pkg; Pkg.test()'
GROUP=QA julia +1.13.3 --compiled-modules=existing --startup-file=no --project=. -e 'using Pkg; Pkg.test()'
GROUP=Core julia +1.12.4 --compiled-modules=existing --startup-file=no --project=lib/NonlinearSolveBase -e 'using Pkg; Pkg.test()'
GROUP=QA julia +1.12.4 --compiled-modules=existing --startup-file=no --project=lib/NonlinearSolveBase -e 'using Pkg; Pkg.test()'
GROUP=Core julia +1.12.4 --compiled-modules=existing --startup-file=no --project=lib/NonlinearSolveFirstOrder -e 'using Pkg; Pkg.test()'
julia +1.13.3 --compiled-modules=existing --startup-file=no --project=docs docs/make.jl
Julia 1.12.7   Reactant Integration | 353  353  19m33.8s
               Testing NonlinearSolve tests passed
Julia 1.13.3   Reactant Integration | 353  353  12m23.4s
               Testing NonlinearSolve tests passed
Root Core      Testing NonlinearSolve tests passed
Root QA        QA            |   28     28  2m02.1s
Base Core      Testing NonlinearSolveBase tests passed
Base QA        Testing NonlinearSolveBase tests passed
FirstOrder     Testing NonlinearSolveFirstOrder tests passed
Docs           [ Info: HTMLWriter: rendering HTML pages.
               [ Info: Automatic `version="4.33.0"` for inventory from ../Project.toml

Root Core's 82 test summaries contained 1,592 passes and 91 existing broken cases, with zero failures or errors. NonlinearSolveBase Core passed 570/570, Base QA passed 20/20, and NonlinearSolveFirstOrder Core passed 9,028/9,028. A second complete Julia 1.12.7 CPU run passed 353/353 in 20m39.0s, and repeating root Core reproduced the same counts. The documentation build finished and emitted its size warnings.

git diff --cached --name-only | rg '\.jl$' | xargs julia +1.12.4 --project=@runic -m Runic --inplace
git diff --unified=0 HEAD^ HEAD | sed -n '/^+++ /!s/^+//p' | typos -
git diff --check HEAD^ HEAD

Runic left the staged files byte-identical. Typos and the whitespace check returned status 0 with empty output.

Julia 1.12.4. The CPU runner exited normally with test status 1 (17 passing, one compilation error) while lowering a broadcast in the Moré augmented right-hand side. A standalone probe importing only Reactant, difference(x) = x .- x on a ConcreteRNumber(2f0), reproduced Missing Julia object for global 'jl_global_46536' on 1.12.4. It returned 0.0f0 on 1.12.7. The installed 1.12.4 runtime lacks jl_get_llvm_gvs_globals, which GPUCompiler uses for this lookup. Use a patched Julia 1.12 runtime with this GPUCompiler release. Julia runtime backport.

Upstream matrix callback. The GC deadlock is still open, and the proposed backend fix is an unmerged draft. These results used released Reactant and the device-side matrix fallback. Reactant deadlock · Draft upstream fix.

CUDA. The latest master push and the reviewed PR both reported 21/22 in the same warning assertion. CUDA 6.4.2 emits the GPUCompiler.compile_hook deprecation inside @test_nowarn. Local verification covered CPU execution. Master job · PR job · Existing tracking issue.

The dense matrix path now uses SVD. GPU behavior, downstream packages and matrix performance were not measured. The changed numerical path and mutable object reconstruction warrant a fresh review.

Next counted review must come from a smart model in a fresh session, not this fix session.


🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a211be-4390-7682-b06f-d658e7e264f6 (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.170.0 gpt-6.2-astra (head c21984b)

The four round-five regressions ran against the reviewed revision and this revision with the same assertions on Julia 1.12.4. The focused run changed from 5 passed, 5 failed, 2 errors to 69/69 passed. Compilation errors previously stopped the initialization and trust-region test sets before their assertions could run.

Finding Reviewed revision 7c408456a Fix and observed result
Dense Newton and inverse The scaled Float32 solve returned [0,0], recomputed residual [-1,-1], and failed the Success assertion. The second inverse diagonal was zero. Square systems use device-side pivoted LU. Singular or rectangular systems use SVD. Host and compiled Newton both returned exactly [1,67108864], zero residual and Success. Matrix right-hand sides passed the small-pivot and singular controls. 8/8.
Auxiliary initialization Compiling the actual quadratic auxiliary solve raised TypeError: non-boolean (Reactant.TracedRNumber{Bool}) used in boolean context. Newton, polyalgorithm and no-init caches carry the initialization result into the outer solve. The failed initializer returned mapped zeros, residual [-2,-2], InitialFailure and zero outer steps where the cache exposes a count. The successful branch reached [2,2] with zero residual and Success. Cached and direct polyalgorithm paths were exercised. 58/58.
Moré augmented right-hand side Compiling the four-element helper raised Missing Julia object for global 'jl_global_61206'. Evaluating the scalar square root before broadcasting produced exactly Float32[0,0,1,2]. 1/1.
Public step! payload The host returned Float32[1.5]. Tracing silently accepted the incompatible payload. The diagnostic assertion reported No exception thrown. A statically active step returns the extension payload. A data-dependent stop requires a nothing result from the active step. The extension test verified the host payload and the exact tracing ArgumentError. 2/2.

Full CPU Reactant runs. Julia 1.12.7 passed 422/422 (36m17s) and 1.13.3 passed 422/422 (40m42s). Julia 1.12.4 completed with 366 passed, 17 errors (54m28s). The trust-region case and all 69 new assertions passed there. The remaining scalar and Broyden cases hit GPUCompiler's missing-global error. This standalone reproducer imports only Reactant, using Reactant 0.2.309 and GPUCompiler 2.10.0:

using Reactant
difference(x) = x .- x
x = Reactant.ConcreteRNumber(2.0f0)
@show Float32(Reactant.@jit difference(x))

Julia 1.12.4 raised Missing Julia object for global 'jl_global_48433'. Julia 1.12.7 printed 0.0f0. This is a pre-existing Julia 1.12.4 toolchain limitation. Julia backport.

External CI lanes. Both Trim failures on the reviewed PR reported JET's captured if_result#242 in host finalization. The reviewed Linux run reproduced it (1 pass, 1 fail). Isolating traced finalization made the full Linux Trim group pass (8 passes, 3 existing broken). macOS awaits CI. The downgrade Watson failure also reproduces on clean master at cee51ef67 with Julia 1.10.14 and the CI dependency downgrade: native Core passed (1,587 passed, 91 existing broken), while generic code generation with the Sandy Bridge OpenBLAS kernel reproduced the exact CI value 3.3209535743826133 ≤ 0.001. Two default-branch pushes report the same value. Master run · Second master run · Existing Watson issue and source bisect.

Validation commands. Julia used four threads and four precompile tasks. The commands below use JULIA_1_13_4 for the Julia 1.13.4 executable and REACTANT_TEST_ENV for each revision's Reactant test environment. The focused driver evaluates the four new test sets verbatim.

julia +1.12.4 --compiled-modules=existing --check-bounds=yes --startup-file=no --project="$REACTANT_TEST_ENV" "$FOCUSED_DRIVER"
for v in 1.12.4 1.12.7 1.13.3; do
    NONLINEARSOLVE_TEST_GROUP=Reactant julia "+$v" --compiled-modules=existing --startup-file=no --project=. -e 'using Pkg; Pkg.test()'
done
for pkg in . lib/NonlinearSolveBase; do
    GROUP=Core julia +1.12.4 --compiled-modules=existing --startup-file=no --project="$pkg" -e 'using Pkg; Pkg.test()'
done
GROUP=QA julia +1.13.3 --compiled-modules=existing --startup-file=no --project=. -e 'using Pkg; Pkg.test()'
for v in 1.12.4 1.13.3; do
    GROUP=QA julia "+$v" --startup-file=no --project=lib/NonlinearSolveBase -e 'using Pkg; Pkg.test()'
done
"$JULIA_1_13_4" --startup-file=no --project=test/trim -e 'include("test/trim/runtests.jl")'
julia +1.13.3 --compiled-modules=existing --startup-file=no --project=docs docs/make.jl
git diff --name-only | rg '\.jl$' | xargs julia +1.12.4 --project=@runic -m Runic --inplace
git diff --unified=0 | sed -n '/^+++ /!s/^+//p' | typos -
git diff --check

Root Core passed 1,592 assertions with 91 existing broken tests. NonlinearSolveBase Core passed 570/570. Root QA passed 28/28. Base QA passed 20/20 on both versions. On 1.12.4, Aqua's 60-second shutdown check initially expired during dependency precompilation. It passed unchanged after precompilation. Docs built through HTML output, Runic left all eight Julia files byte-identical, and spelling and whitespace checks exited zero.

Review regressions                                 |   69     69  6m23.2s
Reactant Integration |  422    422  36m17.3s
Reactant Integration |  422    422  40m42.2s
Reactant Integration                                                    |  366     17    383  54m27.5s
QA            |   28     28  2m11.2s
QA            |   20     20  34.3s
Clean implementation (non-trimmable) |    2      2  1m01.9s
Trimmable implementation |    2      2  20.3s
Run trim      |    4       3      7  1m36.4s

Compiled polyalgorithms with data-dependent initialization require the default store_original=Val(false). Validation covered the CPU backend. GPU hardware, downstream packages and macOS were outside the local runs.

Next counted review must come from a smart model in a fresh session, not this fix session.


🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a212ac-4305-7bd2-a65f-5c0c088f1daf (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.170.0 gpt-6.2-astra (head 0b6e2f2)

CPU Reactant passed 519/519 with zero errors on Julia 1.12.4, 1.12.7 and 1.13.3. Each run used Reactant 0.2.309 and GPUCompiler 2.10.0 with the checkout’s package sources. The four findings from the counted review have regressions on the reviewed head.

Finding Observed on c21984bc0 with the added tests Observed on the fix
Auxiliary initialization tolerances 17 passed, 13 failed. With problem abstol=0.4f0 and caller abstol=0.01f0, the compiled cache took (1,0) child steps and returned [4,4] with Success. With only caller abstol=0.4f0, it stopped at [1.5,1.5]. The one-shot host and compiled calls also used the wrong tolerances. 30/30. Early initialization in both entry points forwards caller tolerances as defaults for get_initial_values. Host and compiled caches map to [1.5,1.5]. The strict solve returns [-2.5,-2.5], InitialFailure and (0,0) child steps. The loose solve returns [4,4], zero residual and Success. Both one-shot cases agree.
Julia 1.12.4 broadcast lowering The scalar scratch test and all eight dense/diagonal, good/bad Broyden denominator cases raised Missing Julia object for global. The scalar trust-region step tests had 9 passes and 1 compilation error in damped Newton. Scratch 1/1, Broyden 8/8, scalar trust-region steps 12/12. Scalar subtraction and trial arithmetic use scalar operators. Broyden guards each denominator before broadcasting. The complete 1.12.4 group has zero residual failures.
Retaining and reusing an initialized cache 22 host assertions passed. Compiled ordinary restart threw Int64(::Reactant.TracedRNumber{Int64}). Retained restart used a traced Bool in a Julia condition. 44/44. The restart carries the selected index and visits statically indexed children under traced conditions. Both solves reach [4,4] with zero residual. Member 2 wins the first solve. On retained restart it exhausts its budget, then member 1 succeeds after wrap-around. Ordinary restart starts at member 1.
Reading the current tolerances Host passed. Compiled tuple indexing raised a getindex MethodError. 2/2. Both getters use the current-child selector and return (0.4f0,0.2f0) on host and CPU Reactant.

An intermediate full run reached scalar broadcasts in Newton descent and trust-region trial arithmetic after scratch allocation succeeded. The final tests exercise actual Newton, damped Newton, trust-region and Broyden solves. An intermediate array Newton change also made the existing allocation test report 720 == 0. Restoring in-place array negation made the unchanged test print allocations = 0.

Validation. The two before runs on Julia 1.12.4 recorded 40 passed, 13 failed, 12 errors for the original five focused test sets and 9 passed, 1 error for the added scalar trust-region test set. Together the same six sets pass 97/97 on the final source. REACTANT_TEST_ENV and ROOT_TEST_ENV below denote the relevant checkout’s test environments. The focused drivers execute the committed test sets verbatim.

export JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=4
export JULIA_PKG_PRECOMPILE_AUTO=0 OPENBLAS_NUM_THREADS=1
for v in 1.12.4 1.12.7 1.13.3; do
    GROUP=Reactant NONLINEARSOLVE_TEST_GROUP=Reactant julia "+$v" --compiled-modules=existing --startup-file=no --project=. -e 'using Pkg; Pkg.test()'
done
for pkg in . lib/NonlinearSolveBase lib/NonlinearSolveFirstOrder lib/NonlinearSolveQuasiNewton; do
    GROUP=Core NONLINEARSOLVE_TEST_GROUP=Core julia +1.12.4 --compiled-modules=existing --startup-file=no --project="$pkg" -e 'using Pkg; Pkg.test()'
    GROUP=QA NONLINEARSOLVE_TEST_GROUP=QA julia +1.13.3 --compiled-modules=existing --startup-file=no --project="$pkg" -e 'using Pkg; Pkg.test()'
done
GROUP=PolyAlgorithms NONLINEARSOLVE_TEST_GROUP=PolyAlgorithms julia +1.12.4 --compiled-modules=existing --startup-file=no --project=. -e 'using Pkg; Pkg.test()'
julia +1.12.4 --compiled-modules=existing --startup-file=no --check-bounds=yes --project="$REACTANT_TEST_ENV" "$FOCUSED_DRIVER"
julia +1.12.4 --compiled-modules=existing --check-bounds=yes --startup-file=no --project="$REACTANT_TEST_ENV" "$SCALAR_DRIVER"
julia +1.12.4 --compiled-modules=existing --check-bounds=yes --startup-file=no --project="$ROOT_TEST_ENV" -e 'include("test/Core/cache_solve_tests__item1.jl"); @show allocations'
julia +1.12.4 --compiled-modules=existing --check-bounds=yes --startup-file=no --project="$ROOT_TEST_ENV" -e 'include("lib/NonlinearSolveFirstOrder/test/allocation_active_step.jl")'
"$JULIA_1_13_4" --startup-file=no --project=test/trim -e 'include("test/trim/runtests.jl")'
git diff --name-only -- '*.jl' | xargs julia +1.12.4 --project=@runic -m Runic --inplace
git diff --unified=0 | sed -n '/^+++ /!s/^+//p' | typos -
git diff --check
Package Core on 1.12.4 QA on 1.13.3
NonlinearSolve 1,592 passed, 91 existing broken 28/28
NonlinearSolveBase 570/570 20/20
NonlinearSolveFirstOrder 9,028/9,028 20/20
NonlinearSolveQuasiNewton 1,078/1,078 20/20

PolyAlgorithms passed 554/554 on 1.12.4. Linux Trim passed 8 assertions with 3 existing broken on 1.13.4. Runic was idempotent on all 15 changed Julia files. Spelling and whitespace checks exited zero.

Review regressions | 40    13     12     65  14m41.5s
Scalar trust-region steps | 9      1     10  3m49.8s
Review regressions | 97     97  7m46.5s
1.12.4  Reactant Integration | 519    519  25m53.4s
1.12.7  Reactant Integration | 519    519  26m48.3s
1.13.3  Reactant Integration | 519    519  19m04.1s
allocations = 0
Warmed active in-place TrustRegion (Moré) step is allocation-free | 5      5  6.6s
Run trim | 4       3      7  2m27.4s
Testing NonlinearSolve tests passed
Testing NonlinearSolveBase tests passed
Testing NonlinearSolveFirstOrder tests passed
Testing NonlinearSolveQuasiNewton tests passed

The final local runs covered CPU execution. GPU hardware, downstream packages, macOS and the docs build were outside these runs. The child branch already carries the identical Broyden file at this child commit.

Next counted review must come from a smart model in a fresh session, not this fix session.


🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a21386-030e-72d2-9b53-a0a3c9a85bd6 (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.170.0 gpt-6.2-astra (head 7099a99)

Diagonal good Broyden now stores Hy = diag(H) .* Δf, uses dot(Δu, Hy) as the denominator, and retains the zero-denominator guard. During Reactant compilation, dense inverse initialization broadcasts a scaled identity across the matrix. After that fix, the default auxiliary solve reached another singleton scalar-indexing error in the Moré descent. Its two augmented right-hand sides now use whole-vector writes while tracing. Round 7 review

Regression on Julia 1.12.4 Reviewed head Fixed head
One-dimensional secant and two-step public solve The inverse was 1 for an exact secant of 2. The diagonal solve returned [3,0], residual [-0.5,0], MaxIters on host and compiled CPU. The 12 update checks passed, including dense matrices and zero denominators. All 18 public solve checks passed, including exact roots, residuals and return codes.
Singleton dense inverse and default auxiliary solve Both compiled solves threw Scalar indexing is disallowed. With the identity fix alone, the compiled auxiliary solve failed in _more_augmented_rhs!. The independent RHS probe gave 2 passes and 1 error. The singleton dense solve reached [4]. The auxiliary solve returned [1.5], outer residual [-2.5], InitialFailure and zero outer steps on host and compiled CPU (10/10). Both RHS sizes passed (4/4).
Cubic solve with plain-norm termination 9 passed and 3 failed. The finite target exhausted its iterations with NaN residual norms. 12/12. The finite target reached the original tolerance. The NaN target retained MaxIters. Both paths matched iterates, and each residual matched recomputation on its backend.

The full focused suite for the two findings recorded 23 passed, 9 failed, 2 errors on the reviewed head and 44 passed, 44 total on the fix, including the four RHS checks.

Local validation. The variables below denote the Julia executables, isolated runner environments, and focused drivers that extract the committed testsets. Each group ran under a shell timeout of 10,800 seconds with four Julia threads, four precompile tasks and one BLAS thread.

export JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=4 JULIA_PKG_PRECOMPILE_AUTO=0 OPENBLAS_NUM_THREADS=1
jl() { timeout 10800 "$1" --startup-file=no --compiled-modules=existing "${@:2}"; }
jl "$JULIA_1124" --check-bounds=yes --project="$BEFORE_REACTANT_ENV" "$BEFORE_FOCUSED_DRIVER"
jl "$JULIA_1124" --check-bounds=yes --project="$BEFORE_REACTANT_ENV" "$AUGMENTED_DRIVER"
jl "$JULIA_1124" --check-bounds=yes --project=test/Reactant "$FOCUSED_DRIVER"
jl "$JULIA_1124" --check-bounds=yes --project="$BEFORE_REACTANT_ENV" "$CUBIC_DRIVER"
jl "$JULIA_1124" --check-bounds=yes --project=test/Reactant "$CUBIC_DRIVER"
for group in Core PolyAlgorithms; do
    GROUP="$group" NONLINEARSOLVE_TEST_GROUP="$group" jl "$JULIA_1124" --check-bounds=yes --project="$ROOT_TEST_ENV" test/runtests.jl
done
GROUP=Reactant NONLINEARSOLVE_TEST_GROUP=Reactant JULIA_LOAD_PATH="@:$ROOT_TEST_ENV:@stdlib" jl "$JULIA_1124" --check-bounds=yes --project="$ROOT_TEST_ENV" test/runtests.jl
GROUP=Reactant NONLINEARSOLVE_TEST_GROUP=Reactant JULIA_LOAD_PATH="@:$RELEASE_RUNNER_ENV:@stdlib" jl "$JULIA_1134" --check-bounds=yes --project="$RELEASE_RUNNER_ENV" -e 'using Pkg; Pkg.instantiate(); include("test/runtests.jl")'
for pkg in lib/NonlinearSolveFirstOrder lib/NonlinearSolveQuasiNewton; do
    GROUP=Core NONLINEARSOLVE_TEST_GROUP=Core jl "$JULIA_1124" --project="$pkg" -e 'using Pkg; Pkg.test()'
done
for pkg in . lib/NonlinearSolveFirstOrder lib/NonlinearSolveQuasiNewton; do
    GROUP=QA NONLINEARSOLVE_TEST_GROUP=QA jl "$JULIA_1133" --project="$pkg" -e 'using Pkg; Pkg.test()'
done
mapfile -t files < <(git diff --name-only -- '*.jl')
jl "$JULIA_1124" --project=@runic -m Runic --inplace "${files[@]}"
git diff --unified=0 | sed -n '/^+++ /!s/^+//p' | typos -
git diff --check
Group Julia Passed Existing broken
Root Core 1.12.4 1,592 91
Root PolyAlgorithms 1.12.4 554 0
QuasiNewton Core 1.12.4 1,078 0
FirstOrder Core 1.12.4 9,028 0
CPU Reactant 1.12.4 563 0
CPU Reactant 1.13.4 563 0
Root QA 1.13.3 28 0
FirstOrder QA 1.13.3 20 0
QuasiNewton QA 1.13.3 20 0

Last test summaries from each run

Root Core on 1.12.4
FastShortcutHomotopyPolyalg + homotopy initialization_alg |   12     12  1m57.6s
Root PolyAlgorithms on 1.12.4
23 Test Problems: PolyAlgorithms |   46     46  1m05.0s
QuasiNewton Core on 1.12.4
Broyden: linsolve keyword |   12     12  3.4s
Testing NonlinearSolveQuasiNewton tests passed
FirstOrder Core on 1.12.4
SciMLOperator Jacobians |   14     14  17.0s
Testing NonlinearSolveFirstOrder tests passed
CPU Reactant on 1.12.4
Reactant Integration |  563    563  61m36.0s
CPU Reactant on 1.13.4
Reactant Integration |  563    563  51m26.4s
Root QA on 1.13.3
QA            |   28     28  8m23.6s
Testing NonlinearSolve tests passed
FirstOrder QA on 1.13.3
QA            |   20     20  27m24.7s
Testing NonlinearSolveFirstOrder tests passed
QuasiNewton QA on 1.13.3
QA            |   20     20  4m39.8s
Testing NonlinearSolveQuasiNewton tests passed

Runic preserved the checksums of all six Julia files. Spelling and whitespace checks exited zero. Local coverage was CPU only. Physical GPU, macOS, docs, downstream and Everything were outside this run.

The sole red check on the reviewed head was Downgrade Core. The latest master downgrade job passed, but the clean master reproduction under the Sandy Bridge OpenBLAS kernel gave the same Watson residual, 3.3209535743826133 ≤ 0.001. The Broyden and identity hunks overlap the child’s work at 9f697a40f. Downgrade check · Master check · Watson tracking issue · Child PR

Next counted review must come from a smart model in a fresh session, not this fix session.


🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a2156f-1630-72d0-ac64-bcb6276d965b (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.170.0 gpt-6.2-astra (head cdd4b72)

Compiled one-shot polyalgorithms copy each supplied device tolerance before initialization and member solves. One executable returned (1.25,-2.75,InitialFailure) and (4,0,Success) as absolute tolerance changed. Host and compiled Broyden matrices matched the independent good and bad rank-one updates, including regular good diagonal [2,9]. Hosted Reactant CI selects Julia 1.12.4 and release.

Julia ran with four threads and four precompile tasks, using checkout sources. Variables identify the interpreters, runner environments and focused test driver. The same driver ran before and after the fix.

jl() { timeout "$1" "$2" --startup-file=no --compiled-modules=existing "${@:3}"; }
jl 10800 "$J12" --check-bounds=yes --project=test/Reactant "$FOCUS"
# Before: error: operand #4 does not dominate this use
#         note: operand defined here (op in a child region)
# After: One-shot auxiliary initialization with device tolerances | 6  6  6m01.7s
for pair in "$J12:$RUN12" "$J13:$RUN13"; do
  e=${pair#*:}; GROUP=Reactant NONLINEARSOLVE_TEST_GROUP=Reactant JULIA_LOAD_PATH="@:$e:@stdlib" jl 14400 "${pair%%:*}" --check-bounds=yes --project="$e" test/runtests.jl
done
for pkg in NonlinearSolveBase NonlinearSolveFirstOrder NonlinearSolveQuasiNewton; do
  GROUP=Core NONLINEARSOLVE_TEST_GROUP=Core jl 14400 "$J12" --check-bounds=yes --project="$ENVS/$pkg" "lib/$pkg/test/runtests.jl"
done
for p in . lib/NonlinearSolveFirstOrder lib/NonlinearSolveQuasiNewton; do
  GROUP=QA NONLINEARSOLVE_TEST_GROUP=QA jl 14400 "$J133" --project="$p" -e 'using Pkg; Pkg.test()'
done
jl 10800 "$J12" --project=@runic -m Runic --inplace $(git diff HEAD^ HEAD --name-only -- '*.jl')
git diff HEAD^ HEAD -U0 | sed -n '/^+++ /!s/^+//p' | typos -
git diff HEAD^ HEAD --check
Reactant Integration | 577 577 66m36.9s (1.12.4)
Reactant Integration | 577 577 56m58.6s (1.13.4)
Dense LU refactorization allocations | 14 14 4.7s (Base, 570 passed)
SciMLOperator Jacobians | 14 14 19.3s (FirstOrder, 9028 passed)
Broyden: linsolve keyword | 12 12 3.9s (QuasiNewton, 1078 passed)
QA | 28 28 4m35.2s (root)
QA | 20 20 6m12.8s (FirstOrder)
QA | 20 20 3m01.2s (QuasiNewton)
Runic, typos, diff --check: exit 0, no output

Next counted review must come from a smart model in a fresh session, not this fix session.


🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a21635-1b9d-7c01-8771-cfd7636c9544 (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.170.0 gpt-6.2-astra (head 9638b3a)

The diagonal and dense good-Broyden updates use the conjugate step in the right factor. On the reviewed head, all four complex secant checks (dense and diagonal, host and compiled CPU) evaluated to zero. Both public solves returned [2im] with residual [-im] and exhausted two iterations. On this head all four updates satisfy the secant equation, and both solves return [4im], an independently verified zero residual and Success.

Julia ran with four threads. J12 and J13 denote Julia 1.12.4 and 1.13.3. CORE_ENV is the QuasiNewton test environment with checkout sources. Reactant 0.2.309 ran on CPU.

timeout 10800 "$J12" --startup-file=no --compiled-modules=existing --check-bounds=yes --project=test/Reactant -e 'using Test; @testset "Diagonal file" begin include("test/Reactant/diagonal_tests.jl") end'
# Diagonal file                                                                          |   64    12     76  32m31.4s
# Diagonal file |   76     76  25m58.0s
GROUP=Core NONLINEARSOLVE_TEST_GROUP=Core timeout 10800 "$J12" --startup-file=no --compiled-modules=existing --check-bounds=yes --project="$CORE_ENV" lib/NonlinearSolveQuasiNewton/test/runtests.jl
# Broyden: linsolve keyword |   12     12  4.9s (1,078 passed across the group)
for pkg in lib/NonlinearSolveQuasiNewton .; do
  GROUP=QA NONLINEARSOLVE_TEST_GROUP=QA timeout 10800 "$J13" --startup-file=no --compiled-modules=existing --project="$pkg" -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'
done
# QA            |   20     20  4m43.1s (QuasiNewton)
# QA            |   28     28  2m56.2s (root)
timeout 3600 "$J12" --startup-file=no --compiled-modules=existing --project=@runic -m Runic --inplace lib/NonlinearSolveQuasiNewton/src/broyden.jl test/Reactant/diagonal_tests.jl
git diff HEAD^ HEAD -U0 | sed -n '/^+++ /!s/^+//p' | typos -
git diff HEAD^ HEAD --check
# Formatting, spelling and whitespace checks exited 0.

Next counted review must come from a smart model in a fresh session, not this fix session.


🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a216f6-a9bc-7fd2-9f67-d9ab27cc33be (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.170.0 gpt-6.2-astra (head 1389485)

The true complex scalar update satisfies the inverse secant equation on the host and under Reactant on CPU. For x/2 - p with p = ComplexF32(1 + 2im), both public Broyden solves reach exactly 2 + 4im in two steps, with an independently evaluated zero residual and Success. Numeric stall checks, residual differencing, Jacobian installation and the default descent step all use scalar operations. The dense good-Broyden update uses the existing step buffer for conjugation.

Dense complex step length Bytes per update before Bytes per update after
8 128 0
128 1,120 0
1,024 8,264 0

Julia 1.12.4 ran with four threads and Reactant 0.2.309 on CPU. The before run used the new test files on an isolated copy of the reviewed head. In the commands below, J12 is the Julia executable, CORE_ENV contains the QuasiNewton dependencies and declared test extras with checkout paths, and the two dense probe drivers run the new Core testset in isolation. The after driver also prints the measured byte counts.

timeout 3600 "$J12" --startup-file=no --compiled-modules=existing --check-bounds=yes --project=test/Reactant -e 'using Test; @testset "Diagonal file" begin include("test/Reactant/diagonal_tests.jl") end'
# Missing Julia object for global 'jl_global_159194'
# TypeError: non-boolean (Reactant.TracedRNumber{Bool}) used in boolean context
# Diagonal file | 81 passed, 2 errors, 83 total

timeout 3600 "$J12" --startup-file=no --compiled-modules=existing --check-bounds=yes --project=test/Reactant -e 'using Test, Reactant, NonlinearSolve; file="test/Reactant/diagonal_tests.jl"; include_string(Main,match(r"(?sm)^@testset \"Complex scalar Broyden\".*",read(file,String)).match,file); flush(stdout); @testset "Diagonal file" begin include(file) end'
# Complex scalar Broyden |   10     10  4m20.7s
# Diagonal file |   86     86  5m15.9s

timeout 3600 "$J12" --startup-file=no --compiled-modules=existing --check-bounds=yes --project=test/Reactant "$DENSE_BEFORE"
# Dense update | 3 passed, 3 failed, 6 total
timeout 3600 "$J12" --startup-file=no --compiled-modules=existing --check-bounds=yes --project=test/Reactant "$DENSE_AFTER"
# Dense update  |    6      6  4.4s

GROUP=Core NONLINEARSOLVE_TEST_GROUP=Core timeout 3600 "$J12" --startup-file=no --compiled-modules=existing --check-bounds=yes --project="$CORE_ENV" lib/NonlinearSolveQuasiNewton/test/runtests.jl
# Broyden       |  600    600  7m34.9s
# Broyden: linsolve keyword |   12     12  3.3s
# 1,084 passes across the 14 Core summaries.

GROUP=QA NONLINEARSOLVE_TEST_GROUP=QA timeout 3600 "$J12" --startup-file=no --compiled-modules=existing --project=lib/NonlinearSolveQuasiNewton -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'
# QA            |   20     20  16m55.1s
# Testing NonlinearSolveQuasiNewton tests passed

# Run in the working tree before committing.
for mode in --inplace --check; do
  timeout 3600 "$J12" --startup-file=no --compiled-modules=existing --project=@runic -m Runic "$mode" $(git diff --name-only -- '*.jl')
done
git diff -U0 | sed -n '/^+++ /!s/^+//p' | typos -
git diff --check
# Formatting, spelling and whitespace checks exited 0.

The two intermediate public-solve failures were a scalar copyto! during Jacobian installation and GPUCompiler lowering of the scalar axpy! broadcast. Both required the numeric cases in QuasiNewton's solve.jl. Validation covered the affected Reactant file and QuasiNewton Core and QA. Physical GPU, downstream, docs, and the remaining matrix were outside this run.

Next counted review must come from a smart model in a fresh session, not this fix session.


🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a21780-f420-7b20-ba5c-392c374b0cc9 (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.169.0 gpt-6.1-terra (head 919e2d5)

The scalar bad-Broyden update conjugates its right factor, preserving the complex inverse secant equation. The dense complex rank-one update avoids the Julia 1.10 allocation; the existing real and generic paths remain in use. Scalar tests cover both rules, host and compiled, including exact roots and residuals.

Julia ran with four threads. CORE_ENV denotes a scratch environment with the QuasiNewton test extras and checkout dependencies, and PROBE denotes the warmed allocation driver. Reactant used its CPU backend. The before test ran on the original source with the new regression tests; its bad-rule host and compiled results both showed 0im == 2im for the secant and 2im == 4im for the solve. Its scalar summary was 20 passed, 20 failed; the good-rule cases passed.

GROUP=Core NONLINEARSOLVE_TEST_GROUP=Core timeout 3600 julia +1.10.13 --startup-file=no --compiled-modules=no --check-bounds=yes --project="$CORE_ENV" lib/NonlinearSolveQuasiNewton/test/runtests.jl
# Broyden | 816  816  8m13.8s
# Broyden: linsolve keyword | 12  12  1.5s

GROUP=Core NONLINEARSOLVE_TEST_GROUP=Core timeout 3600 julia +1.12.4 --startup-file=no --compiled-modules=existing --check-bounds=yes --project="$CORE_ENV" lib/NonlinearSolveQuasiNewton/test/runtests.jl
# Broyden | 600  600  6m06.8s
# Broyden: linsolve keyword | 12  12  1.7s

timeout 3600 julia +1.12.4 --startup-file=no --compiled-modules=existing --check-bounds=yes --project=test/Reactant -e 'using Reactant; Reactant.set_default_backend("cpu"); include("test/Reactant/diagonal_tests.jl")'
# Compiled diagonal quasi-Newton | 20  20
# Broyden update with regular and zero denominators | 24  24
# Two-step Broyden solve | 32  32
# Complex scalar Broyden | 44  44

timeout 3600 julia +1.10.13 --startup-file=no --compiled-modules=no --project="$CORE_ENV" "$PROBE"
# n=8 bytes=0; n=128 bytes=0; n=1024 bytes=0
timeout 3600 julia +1.12.4 --startup-file=no --compiled-modules=existing --project="$CORE_ENV" "$PROBE"
# n=8 bytes=2128 (first measurement); n=8 bytes=0; n=128 bytes=0; n=1024 bytes=0

julia +1.12.4 --compiled-modules=existing --project=@runic -m Runic --inplace lib/NonlinearSolveQuasiNewton/src/broyden.jl test/Reactant/diagonal_tests.jl
git diff --check
git diff -U0 | sed -n '/^+++ /d; /^+/p' | typos -
# All three exited successfully without output.

QA and the full Reactant group were not run, as requested. CI was started but not awaited.

Next counted review must come from a smart model in a fresh session, not this fix session.


🤖 Posted by an AI agent — harness: Codex CLI 0.169.0 · model: gpt-6.1-terra
Conversation: local session 01a2180b-7562-7d30-9728-3fe53c92919a (no session URL)

@ChrisRackauckas-Claude

ChrisRackauckas-Claude commented Aug 27, 2026 •

Copy link
Copy Markdown
Member Author

Rework plan for this draft:

  • Remove the solver allowlist and bespoke Reactant solve interception so algorithms use their normal solve dispatch.
  • Remove the local differentiation overloads; derivative-backed algorithms should rely on upstream backend support and surface upstream errors normally.
  • Make the derivative-free SimpleBroyden and SimpleKlement loops traceable and test those algorithms as complete compiled solves.
  • Record failing-before and passing-after evidence, then run Reactant, Core, Runic, typos, QA, and docs locally before the next push.

QA currently fails during environment resolution on unchanged upstream master because the QA environment requires NLsolve 4.x while NonlinearSolve requires NLsolve 5.x; that baseline regression is being bisected separately.

@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Add Reactant-compiled Newton solve path Let Reactant trace standard nonlinear solver dispatch Aug 27, 2026
@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the reactant-jit-solve branch 3 times, most recently from 3541207 to 29bc671 Compare August 28, 2026 13:15
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Let Reactant trace standard nonlinear solver dispatch Trace the nonlinear solver loops under Reactant Aug 29, 2026
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

CI triage: the only red lanes so far are the three Wrappers jobs, which also fail on master's latest CI_NonlinearSolve run (6 Wrappers failures there; the released-NLsolve regression addressed by #1209). Everything else is pending or green.

🤖 Posted by an AI agent (Claude Code, model claude-fable-5) on behalf of Chris Rackauckas. Session: https://claude.ai/code/session_016LsC6pp9z6s5EABX9DnVjE

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Rebuilt on current master (head 90ccb4245): the previous push had been generated from a tree one commit behind and silently reverted #1211's SCC line; that is fixed and SCC's Core group passes again locally. The layout-agnostic NonlinearSolution constructors are also carved out as #1214 so they can be released ahead of SciMLBase#1563; this PR will be rebased on it once merged.

🤖 Posted by an AI agent (Claude Code, model claude-fable-5) on behalf of Chris Rackauckas. Session: https://claude.ai/code/session_016LsC6pp9z6s5EABX9DnVjE

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Rebased onto master after #1072 (adaptive Jacobian reuse). The reuse policy decides make_new_jacobian from residual-norm ratios, which are traced under Reactant, so __init switches it off (without_jacobian_reuse) during compilation and every traced step recomputes the Jacobian; on the host the policy, including the stale-Jacobian retries, is untouched. Versions: NonlinearSolveBase 2.50.0 (2.49.0 was released meanwhile), FirstOrder 2.5.1, SCC 1.15.3, QuasiNewton 1.15.3. Re-validated locally: Base Core+QA, FirstOrder Core+QA, Reactant group 102/102 (this PR) and 147/147 (with #1213), Simple Core 1.10/1.12 + QA.

🤖 Posted by an AI agent (Claude Code, model claude-fable-5) on behalf of Chris Rackauckas. Session: https://claude.ai/code/session_016LsC6pp9z6s5EABX9DnVjE

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

CI triage: the red OrdinaryDiffEq.jl/* lanes (Downstream workflow) fail during environment resolution — Unsatisfiable requirements detected for package AlgebraicMultigrid against NonlinearSolveBase's TimerOutputs = "1" compat — and they fail identically on master's own push run 33303882132 (and on #1072's last run), after having passed earlier the same day, so it is a registry-side change unrelated to this PR. It is being investigated separately.

🤖 Posted by an AI agent (Claude Code, model claude-fable-5) on behalf of Chris Rackauckas. Session: https://claude.ai/code/session_016LsC6pp9z6s5EABX9DnVjE

Run every algorithm's ordinary `solve` dispatch under `Reactant.@compile`. The
shared solver loop is a `ReactantCore.@trace while` over `CommonSolve.step!`,
return codes are traced enums (EnzymeAD/Reactant.jl#3232, SciMLBase#1563) so
the solution is built by `SciMLBase.NonlinearSolution` on every path, and the
loop-carried cache state is refreshed by one reflective `dealias_traced!`
instead of per-cache field lists. Trust-region, Levenberg-Marquardt, geodesic
and dogleg updates are written once with `ifelse`; polyalgorithms are traced
as a chain of their members. Forward-mode `AutoEnzyme` is preferred during
compilation.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude <[email protected]>
Agent-Harness: Claude Code 2.1.251
Agent-Model: claude-fable-5
Agent-Session: https://claude.ai/code/session_016LsC6pp9z6s5EABX9DnVjE
ChrisRackauckas and others added 11 commits November 22, 2026 08:26
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261122T125333Z-codex-gpt-6.2-astra
Agent-Session: local session 01a20351-c92f-7a63-9f2c-190beb8b0e01 (no session URL)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261123T114922Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2083d-5ca4-7700-8319-fe7ea2c76de2 (no session URL)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261123T114922Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2083d-5ca4-7700-8319-fe7ea2c76de2 (no session URL)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261123T114922Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2083d-5ca4-7700-8319-fe7ea2c76de2 (no session URL)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261123T114922Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2083d-5ca4-7700-8319-fe7ea2c76de2 (no session URL)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261123T114922Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2083d-5ca4-7700-8319-fe7ea2c76de2 (no session URL)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261123T114922Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2083d-5ca4-7700-8319-fe7ea2c76de2 (no session URL)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261123T114922Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2083d-5ca4-7700-8319-fe7ea2c76de2 (no session URL)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261123T114922Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2083d-5ca4-7700-8319-fe7ea2c76de2 (no session URL)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261123T114922Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2083d-5ca4-7700-8319-fe7ea2c76de2 (no session URL)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261123T114922Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2083d-5ca4-7700-8319-fe7ea2c76de2 (no session URL)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

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

PR: #1197

Reviewed head: 97a1fda
Raw SHA-256: ced1f32dd396ea8e6e6add9a835fef40fd9eb49d386602db2e69be808d463fd1
Source SHA-256: 8bd95727363d52ae353309e93c566013611c5f53bbce374983dfb6b15c8b1fb1
Source: standard-review-v1 (harness-log)
Reviewer session: 01a21184-f41b-76c3-a96d-5b6fdfd2dbc1
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: high (H2)
  • Verdict: CHANGES
  • Reviewed head: 97a1fda

Review report

VERDICT: CHANGES
Round: 7
Head: 97a1fda
Slot: 1
CI: CI is not green
Session: 01a21184-f41b-76c3-a96d-5b6fdfd2dbc1
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

high (H2: the default TrustRegion Moré damping safeguard changes Float32 arithmetic on the host. One of 500 default one-step solves returned a different iterate on this head.)

Blocking findings

  • Blocking priorities: P1, P1, P1, P1, P2, P2, P2
  1. [P1] A compiled polyalgorithm can report success at a point that is not a root. At lib/NonlinearSolveBase/src/solve.jl:728, the next member resets the shared starting buffer even when the first member succeeded. I used two members that honor alias_u0=true by writing their root into prob.u0 and returning that buffer. For f(x) = x*(x-1) starting at 3, the host returned the first root, 0. The compiled solve returned u=[3], resid=[0], Success. Evaluating the residual at the returned point gives 6.
    Implementation fix: In _polysolve_compile_path, reset the workspace inside the branch that actually runs a subsequent member. Copy each retained candidate's state and residual before another member can mutate their storage. In test/Reactant/polyalgorithm_tests.jl, use aliasing members for both first-success and all-failed cases. Assert the selected iterate, the caller's final buffer, and sol.resid == f(sol.u, p).

  2. [P1] Public compiled step! takes the wrong Newton step and advances stopped caches. At lib/NonlinearSolveBase/src/solve.jl:976, I called step!(init(...)) on an array problem with f(x)=x²-2, analytic Jacobian 2x, and starting value 1. With maxiters=1 the host returned (u,resid,nsteps)=(1.5,0.25,1). Compiled execution returned (0,-2,1). With maxiters=0 it returned the same wrong triple, while the host preserved (1,-1,0). Calling dealias_traced! before the bare step did not fix the active case.
    Implementation fix: Factor the unchecked step and counter updates out of the public wrapper. Have the full driver call that helper inside its existing traced loop. Have the public compiled wrapper carry the cache through at most one traced iteration, gated by not_terminated(cache). I tested this loop shape in scratch and obtained the exact expected triples for both limits. Add both assertions to test/Reactant/first_order_tests.jl.

  3. [P1] A compiled solve can overwrite initialization failure with success. The early return at lib/NonlinearSolveBase/src/solve.jl:368 is host-only. I isolated the cache contract by setting an initialized Newton cache's return code to InitialFailure, the state produced by a failed initializer. On f(x)=x-2 from 3, host solve! returned (3,1,InitialFailure). Compiled solve! advanced to (2,0,Success).
    Implementation fix: Include initialization status in the traced loop guard and bypass successful-solve finalization for a failed initializer. Apply the same rule to the cached polyalgorithm and no-init drivers that also gate their failure checks on host execution. Add a failing-initialization regression to test/Reactant/first_order_tests.jl asserting zero steps, the initial state and residual, and InitialFailure.

  4. [P1] The CPU Reactant suite hangs in the compiled matrix linear solve. At lib/NonlinearSolveBase/src/linear_solve.jl:156, the default solve enters LinearSolve's Julia host callback. The official group hung on Julia 1.12.4. Direct runs of the test file also hung on 1.12.4 and 1.13.3. In all three stack captures the callback was waiting in jl_gc_wait_for_the_world and the calling thread was waiting for the XLA executable. I terminated the stalled processes. Some individual solves completed, and a standalone callback that copied an array and explicitly ran GC also completed.
    Implementation fix: Make the matrix path use a LinearSolve/Reactant integration that permits GC while PJRT execution and result synchronization wait for the Julia callback. If that requires an upstream fix, require the corrected backend version before enabling this path. Add a cold-process CPU regression for the documented analytic-Jacobian Newton example that materializes both u and resid and checks the root. Run the complete Reactant group on the supported Julia versions with normal GC.

  5. [P2] The compiled fallback skips a successful exact solution. _poly_success at lib/NonlinearSolveBase/src/solve.jl:655 omits ExactSolutionLeft and ExactSolutionRight. With a first member returning root 0 and ExactSolutionLeft, and a second returning root 1 and Success, the host returned 0 with the first code. The compiled solve returned 1 with the second code.
    Implementation fix: Make the traced predicate match the host's successful-retcode policy, including both endpoint codes and its explicit StalledSuccess exception. Extend test/Reactant/polyalgorithm_tests.jl with both endpoint codes and assert the first member's root and return code survive.

  6. [P2] Dealiasing attempts to overwrite a user's const parameter field. At lib/NonlinearSolveBase/src/reactant.jl:62, an out-of-place Newton solve with mutable struct FrozenParam{A}; const value::A; end and f(u,p)=u.-p.value returned [2], Success on the host. Compilation failed with setfield!: const field .value of type FrozenParam cannot be changed. The stack identifies _dealias_traced!.
    Implementation fix: Reconstruct affected objects with const fields when a traced child needs replacement, and track old-to-new objects so shared and cyclic references stay consistent. Keep caller-owned parameter fields intact. Add this parameter type to test/Reactant/reactant_tests.jl and assert the root, zero residual, and unchanged input parameter.

  7. [P2] The combined absolute/relative norm termination mode cannot compile. At lib/NonlinearSolveBase/src/termination_conditions.jl:243 the traced path calls check_convergence(::NormTerminationMode), whose short-circuit at line 427 requires a Julia Bool. Newton on x²-2 from 1 returned 1.4142135f0, Success on the host. Compilation raised TypeError: non-boolean (Reactant.TracedRNumber{Bool}) used in boolean context at line 427.
    Implementation fix: Combine the absolute and relative predicates with traced Boolean operations during compilation. Preserve the host short-circuit. Add cases in test/Reactant/termination_tests.jl where only the absolute or only the relative criterion succeeds and compare the stopping step and return code.

Non-blocking findings

  • docs/src/tutorials/nonlinear_solve_gpus.md:120 does not identify the limit on box bounds. Broyden on x-2 in [0,4] from 1 returned approximately 2 on the host. Compilation raised a traced-Boolean error in _clamp_to_bounds. Implementation fix: For the current support scope, add the sentence “Whole-solve compilation does not support the box-bounds transformation.” Reject this case with an actionable ArgumentError at the entry to transform_bounded_problem and assert that message in the Reactant tests.
  • lib/NonlinearSolveBase/src/descent/more_trust_region.jl:1585 and lib/NonlinearSolveFirstOrder/src/levenberg_marquardt.jl:312 describe the code relative to master. Implementation fix: Replace the first comment with “Isolate traced selection so Trim and JET see ordinary host control flow.” Delete the parenthetical “(master @bb @. path)” from the second. These are comment-only edits.

What I ran

  • Verified the head and inspected all 64 changed paths with git diff --name-status -M origin/master...HEAD. There were no renames. The benchmark workflow adds an LTS test to a read-only PR job. Its permissions, artifact upload and triggers are unchanged. git diff --check origin/master...HEAD passed.
  • Ran GROUP=Core julia --startup-file=no --project=<package> -e 'using Pkg; Pkg.test()' from a scratch copy on Julia 1.12.4 with the supplied depot. All six groups passed. The root reported 1,592 passing assertions, NonlinearSolveBase 574, FirstOrder 9,028, QuasiNewton 1,078, SpectralMethods 48, and SCCNonlinearSolve 95.
  • Ran NONLINEARSOLVE_TEST_GROUP=Reactant julia --startup-file=no --project=. -e 'using Pkg; Pkg.test()' and independently ran julia --startup-file=no --project=test/Reactant test/Reactant/reactant_tests.jl. The direct test used Reactant 0.2.309 on both Julia versions. The hangs and stack captures are described above. Separate host/PJRT probes produced the values in the findings. The control using the same alias option and two built-in Newton members returned u=[2], resid=[0] on both paths.
  • Ran the default TrustRegion() for one iteration on 500 seeded Float32 linear systems on the base and head. Case 233 changed its first component from 0.040142298f0 to 0.040142417f0. Both returned MaxIters. A separate direct check of the Moré safeguard returned Float64(0.01) on base and 0.01f0 on head. External package versions common to the two FirstOrder manifests matched.
  • Ran benchmark/test_sources.jl with AirspeedVelocity 0.6.5 and Julia 1.10.12. All three source-resolution checks passed. The installed ReactantCore and ConstructionBase licenses carry MIT terms.
  • uv run --locked python --version printed Python 3.13.13 and warned that the lock option had no effect outside a Python project. This checkout has no Python project lock or Julia manifest.

What I did not verify

The Reactant suite did not finish on either interpreter. I did not run physical GPU tests, downstream packages, the docs build, full benchmark timings, or remote CI. The initialization-failure probe isolated the cache state without running a failing auxiliary initialization problem. A separate compiled Broyden probe with recompute_jacobian=false stopped at a Reactant “Missing Julia object” error, so its numerical behavior remains unverified.

AUTHOR_GRADE: {"task":"feature","score":2,"difficulty":5,"rounds":7,"author_harness":"Codex CLI 0.170.0","author_model":"gpt-6.2-astra","note":"Six host core groups passed. Independent CPU compilation probes returned false success and incorrect Newton iterates, and the integration suite hung on two Julia versions."}

Head link: 97a1fda


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a21184-f41b-76c3-a96d-5b6fdfd2dbc1 (no session URL)

Carry stopped and failed caches through traced control flow, and retain
independent polyalgorithm candidates. Preserve shared and cyclic const-field
parameters, combine norm criteria during tracing, and keep the host Moré
safeguard arithmetic. Lower default dense solves to a device-side SVD and
report unsupported matrix configurations and box transformations at compile time.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261125T080644Z-codex-gpt-6.2-astra
Agent-Session: local session 01a211be-4390-7682-b06f-d658e7e264f6 (no session URL)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

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

PR: #1197

Reviewed head: 7c40845
Raw SHA-256: ad4f9c07e3db0140bb723b7f5a3c8d78d5ca4f2f26826c358bf756996c177f84
Source SHA-256: d5c856aa25b3eed9c7620f2a4fdcde2d2c4d3ac51cbf6561679d8d70c7545349
Source: standard-review-v1 (harness-log)
Reviewer session: 01a21290-5947-73f0-aee5-23ef9e09f951
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: medium-high (MH1)
  • Verdict: CHANGES
  • Reviewed head: 7c40845

Review report

VERDICT: CHANGES
Round: 8
Head: 7c40845
Slot: 1
CI: CI is not green
Session: 01a21290-5947-73f0-aee5-23ef9e09f951
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

medium-high (MH1: the shared Newton and trust-region drivers expose different results, errors, and public step return values under compilation. The host Moré safeguard matched the base in my comparisons.)

Blocking findings

  • Blocking priorities: P1, P1, P1, P2
  1. [P1] Dense compiled Newton discards an exactly solvable equation. At lib/NonlinearSolveBase/src/utils.jl:338, the SVD solve truncates small singular values. I used a dense Float32 matrix A = diagm(Float32[1, 2.0^-26]), residual A*u .- 1, analytic Jacobian A, and a zero starting vector. With absolute tolerance 1f-6, the host returned [1, 67108864], zero residual, and Success. Compiled Newton returned [1, 0], residual [0, -1], and MaxIters after eight steps. Both paths solved the identity-matrix control. A separate compiled lu(A; check=false) \ b produced the exact solution and zero residual.
    Implementation fix: In traced_matrix_solve, use a device-side pivoted solve for square nonsingular systems and reserve a rank-revealing fallback for failed factorizations or least squares. Apply the policy to both the Newton cache in linear_solve.jl and the matrix right-hand side in linsolve_identity!!. Update the GPU tutorial's SVD description. Add the scaled system to test/Reactant/linear_tests.jl and assert the exact two components, recomputed zero residual, and successful return code. Retain a singular-system case for the fallback.

  2. [P1] A real failed initializer still prevents compilation. The test at test/Reactant/first_order_tests.jl:67 assigns the failure code after init returns. I instead supplied SciMLBase.OverrideInitData with auxiliary residual x.^2 .+ 1, dense analytic Jacobian diagm(2 .* x), initial state ones(Float32, 2), and maxiters=1. The outer Newton problem was u .- 2. Host execution returned u=[0,0], residual [-2,-2], and InitialFailure. Compilation raised TypeError: non-boolean (Reactant.TracedRNumber{Bool}) used in boolean context at lib/NonlinearSolveBase/src/initialization.jl:33. A separately injected, data-dependent cache status was handled correctly. The failure occurs before the new loop guard.
    Implementation fix: In _run_initialization!, use the traced success flag to select the cache return code. Carry that status through the polyalgorithm and no-init caches and guard their solve paths with traceable control flow. Extend first_order_tests.jl with the actual auxiliary problem. Assert the mapped iterate, recomputed residual, zero outer Newton steps, and InitialFailure. Include a successful initializer to exercise the other branch.

  3. [P1] The CPU Reactant group still errors on Julia 1.12.4. The tutorial Newton case completed. Compiling TrustRegion() at test/Reactant/reactant_tests.jl:130 then failed with Missing Julia object for global. I isolated the error to _more_augmented_qrhs! at lib/NonlinearSolveBase/src/descent/more_trust_region.jl:1385. For Dp=Float32[2,4], λ=4f0, and m=2, the helper failed both with default bounds settings and with --check-bounds=yes. A probe that evaluated the scalar square root before broadcasting into the same view returned Float32[0,0,1,2]. The existing helper also returned that value on Julia 1.13.3.
    Implementation fix: Compute sqrtλ = sqrt(λ) outside the dotted assignment in _more_augmented_qrhs!, then assign Dp ./ sqrtλ into the lower view. Add the four-element compiled helper regression to the Reactant tests and rerun the existing full group on both Julia versions.

  4. [P2] Public compiled step! silently discards the implementation's return value. At lib/NonlinearSolveBase/src/solve.jl:989, the wrapper always returns nothing. I exercised the documented positional-argument extension with an InternalAPI.step! method that performs the Newton step and returns a copy of the updated iterate. Both paths advanced from [1] to [1.5]. The host returned [1.5] and compiled execution returned nothing.
    Implementation fix: In the compiled public wrapper, retain the result when it can be represented faithfully. For implementations whose active and stopped return types cannot share a compiled result, I recommend rejecting the unsupported return type with a clear ArgumentError during tracing. Document that limit in the step! docstring. Add a returning-step extension to test/Reactant/first_order_tests.jl and assert its host payload and the supported compiled behavior or explicit diagnostic. The full solve driver can continue ignoring the step payload.

Non-blocking findings

None.

What I ran

  • Confirmed the requested head, byte-compared the supplied delta with the Git diff, and inspected all 66 changed paths with rename detection. The workflow change adds an LTS source-resolution test to a read-only PR benchmark job. git diff --check origin/master...HEAD passed. The checkout remained clean.
  • Ran NONLINEARSOLVE_TEST_GROUP=Reactant julia --startup-file=no --project=. -e 'using Pkg; Pkg.test()' in scratch copies with the supplied depot. Both resolved Reactant 0.2.309. Julia 1.13.3 passed 353/353. Julia 1.12.4 reported 17 passed, 1 error. The tutorial Newton test passed all four assertions on both versions, including materialization of the residual. The full test file also exited successfully when run directly on 1.13.3.
  • Ran the polyalgorithm and linear test files and the new public-step, initialization-status, damping, and combined-norm testsets independently on 1.12.4. 112/112 passed. The covered cases include both successful endpoint return codes and retention of the aliased winning iterate.
  • Ran GROUP=Core julia --startup-file=no --project=. -e 'using Pkg; Pkg.test()' on 1.12.4 for the root and with --project=lib/NonlinearSolveBase for Base. Both passed, with 1,592 and 570 assertions respectively. Compared the host damping helper to the definition extracted from origin/master on 2,000 seeded inputs per type. Float32 and Float64 each had zero value or type mismatches.
  • Ran the independent matrix, auxiliary-initialization, step-return, and augmented-right-hand-side probes described above. Three public Newton step calls with a two-step limit left both host and compiled caches at u=[1.4166666f0] with two completed steps.
  • uv run --locked python --version printed Python 3.13.13 and warned that the lock option had no effect outside a Python project. The checkout has no Python lockfile or committed Julia manifest. Julia dependencies were resolved from the checkout's project files and local package sources.

What I did not verify

I did not run on physical GPUs, run downstream packages, build the docs, or measure factorization performance. The hoisted-square-root probe verified the isolated operation. I did not patch the package or rerun the full group with that change.

AUTHOR_GRADE: {"task":"feature","score":3,"difficulty":5,"rounds":8,"author_harness":"Codex CLI 0.170.0","author_model":"gpt-6.2-astra","note":"The current Julia Reactant group and both host core groups pass. Focused probes established loss of a full-rank Newton direction, a real initialization failure that cannot compile, a Julia 1.12 trust-region compile error, and a dropped public step result."}

Head link: 7c40845


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a21290-5947-73f0-aee5-23ef9e09f951 (no session URL)

Use device-side pivoted LU for square systems and retain rank-revealing
solves for singular or rectangular matrices. Carry auxiliary initialization
failure through Newton, polyalgorithm and no-init caches. Honor supported
step payloads and diagnose incompatible data-dependent returns.

Evaluate the Moré damping square root before broadcasting and keep traced
finalization out of host inference. Cover the compiled and host behavior
with exact solutions, residuals, return codes and step counts.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261125T122641Z-codex-gpt-6.2-astra
Agent-Session: local session 01a212ac-4305-7bd2-a65f-5c0c088f1daf (no session URL)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

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

PR: #1197

Reviewed head: c21984b
Raw SHA-256: 1a6743c7486127fef5c034116608af48943fda50aff85f66a49267188603e514
Source SHA-256: 35f04a341ea034250b13268657333e67fb18cb099308900b5d0e723162ff61ee
Source: standard-review-v1 (harness-log)
Reviewer session: 01a21369-1a4a-7e32-9452-c4793ec982e7
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: medium-high (MH1)
  • Verdict: CHANGES
  • Reviewed head: c21984b

Review report

VERDICT: CHANGES
Round: 9
Head: c21984b
Slot: 1
CI: green
Session: 01a21369-1a4a-7e32-9452-c4793ec982e7
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

medium-high (MH1: the shared polyalgorithm initializer can turn InitialFailure into Success, and compiled Newton and Broyden calls error on Julia 1.12.4.)

Blocking findings

  • Blocking priorities: P1, P1, P2, P2
  1. [P1] A compiled polyalgorithm can report success after its auxiliary initializer fails the caller's tolerance. At lib/NonlinearSolveBase/src/polyalg.jl:320, initialization runs on the problem before the cache exists. It reads the problem's tolerances and misses overrides passed to init. I used two Newton members, outer residual u .- 4, and a one-step auxiliary Newton solve for x.^2 .- 2 from ones with an absolute maximum-norm test. Its iterate is exactly 1.5 and its residual is 0.25 in each component. With problem abstol=0.4f0 and call-site abstol=0.01f0, the host returned [1.5, 1.5], residual [-2.5, -2.5], and InitialFailure. Compiled execution returned [4, 4], zero residual, and Success. Conversely, with no problem-level tolerance and call-site abstol=0.4f0, only the host ran the outer solve.

    Implementation fix: Pass the effective call-site abstol and reltol into the early run_initialization! call. In initialization.jl, use them as the defaults supplied to SciMLBase.get_initial_values, preserving an explicit OverrideInit tolerance's precedence. Reuse that resolution in the problem-based one-shot polyalgorithm entry points in solve.jl. Add both tolerance cases to test/Reactant/first_order_tests.jl. Check the mapped state, the recomputed outer residual, and the return code on host and compiled paths. For the strict case assert zero steps in each outer child.

  2. [P1] The Julia 1.12.4 CPU Reactant group still errors. The revised Moré right-hand side passed. The full group then recorded 17 errors reporting Missing Julia object for global. One stack reached the scalar u .- u in lib/NonlinearSolveBase/src/termination_conditions.jl:130. The other 16 reached the broadcasted scalar denominator guard in lib/NonlinearSolveQuasiNewton/src/broyden.jl:149 or its diagonal variant at line 164. I reproduced both operations independently. Plain scalar subtraction produced 0f0. Moving the guard outside the vector broadcast produced [1, -2] for numerator [2, -4] and denominator 2, and [200000, -400000] for denominator zero.

    Implementation fix: Give alloc_u_diff_cache(u::Number) a scalar u - u path. In both dense and diagonal InternalAPI.solve! methods for BroydenUpdateRuleCache, compute ifelse(iszero(denom), T(1.0e-5), denom) once before the elementwise update, including the good and bad diagonal rules. Add compiled tests for the scalar scratch value and the two denominator cases. Keep the existing end-to-end scalar Newton, Broyden, and LimitedMemoryBroyden assertions and run the full Reactant group on both Julia versions.

  3. [P2] Reusing the initialized polyalgorithm cache fails to compile. The traced indices constructed at lib/NonlinearSolveBase/src/polyalg.jl:342 reach native integer and Boolean operations in InternalAPI.reinit!. I solved the initialized problem, called ordinary reinit!(cache, zero.(u)), and solved again. The host returned [4, 4] both times. Compilation raised MethodError: no method matching Int64(::Reactant.TracedRNumber{Int64}) at line 238. With retain_best=true, compilation instead raised a non-Boolean-condition error at line 234. The corresponding host call succeeded.

    Implementation fix: For an ordinary restart, set start_current directly from the static alg.start_index. For retention, carry the selected start in a trace-compatible field. In InternalAPI.reinit! and _solve_initialized_polycache!, visit the statically indexed children with traced predicates for the retained start, deferred reinitialization, and wrap-around. Preserve the configured lower bound and periodic re-probe. Extend first_order_tests.jl with two consecutive solves of one initialized cache, both with and without retention. Assert both solutions and residuals, and use a second-member winner to check that retention starts there and can still fall back.

  4. [P2] The documented tolerance accessor cannot read the initialized compiled cache. At lib/NonlinearSolveBase/src/polyalg.jl:157, get_abstol indexes a Julia tuple with the newly traced cache.current. Immediately after init, my host query returned (0.4f0, 0.2f0) for the absolute and relative tolerances. Compilation stopped at the first getter with a tuple getindex MethodError. The relative getter at line 160 uses the same indexing expression.

    Implementation fix: Route get_abstol and get_reltol through _poly_current_value, as the iterate and residual accessors already do. Add a compiled regression in first_order_tests.jl that reads both tolerances after data-dependent initialization and compares them with the explicitly supplied values.

Non-blocking findings

None.

What I ran

  • Verified the full head SHA, byte-compared the supplied delta with the Git diff, and inspected all 67 changed paths with rename detection. The benchmark workflow adds a source-resolution test to a read-only pull-request job. It has no deployment, merge, publishing, or registration step. git diff --check origin/master...HEAD passed and git status --porcelain was empty.
  • Ran NONLINEARSOLVE_TEST_GROUP=Reactant julia --startup-file=no --project=. -e 'using Pkg; Pkg.test()' on scratch copies of the head with the supplied layered depot. Both resolved Reactant 0.2.309. Julia 1.13.3 passed 422/422. Julia 1.12.4 reported 366 passed, 17 errors. On 1.12.4 the four new regression sets passed all 69 assertions: dense pivots 8, auxiliary initialization 58, Moré right-hand side 1, public step payload 2.
  • Ran the same package test entry point with GROUP=Core and GROUP=PolyAlgorithms on Julia 1.12.4. They passed 1,592/1,592 and 554/554 respectively.
  • Ran the independent initialization, cache reuse, tolerance-accessor, scalar subtraction, and denominator probes described above on Julia 1.12.4. A compiled row-permuted 3×3 system with a small nonzero pivot recovered the exact all-ones solution. A rank-deficient square system had zero recomputed residual, and a rectangular 3×2 system had maximum absolute residual 2.3841858f-7.
  • uv run --locked python --version printed Python 3.13.13 and warned that the lock option has no effect outside a Python project. The checkout contains neither a Python lockfile nor a committed Julia manifest. Julia dependencies were resolved from the checkout's projects and local package sources.

What I did not verify

I did not run on physical GPUs, build the docs, run downstream packages, or benchmark performance. The isolated scalar and denominator probes exercised the proposed expressions. I did not modify the solver or rerun the suite with proposed fixes.

AUTHOR_GRADE: {"task":"feature","score":3,"difficulty":5,"rounds":9,"author_harness":"Codex CLI 0.170.0","author_model":"gpt-6.2-astra","note":"The four new regression sets pass on both Julia versions. Independent probes found a false initialization success and two compiled cache interface failures. The full Reactant group still errors on Julia 1.12.4."}

Head link: c21984b


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a21369-1a4a-7e32-9452-c4793ec982e7 (no session URL)

Pass the caller's tolerances to auxiliary initialization in cached and
one-shot polyalgorithms. Select tolerances and retained members through
static child indices, preserving lazy reinitialization and wrap-around
when the winning index depends on traced values.

Use scalar arithmetic for Newton steps and guard Broyden denominators
before broadcasting. Exercise initialization failure, cache reuse,
scalar trial steps and rank-one updates through CPU Reactant.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261125T162432Z-codex-gpt-6.2-astra
Agent-Session: local session 01a21386-030e-72d2-9b53-a0a3c9a85bd6 (no session URL)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

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

PR: #1197

Reviewed head: 0b6e2f2
Raw SHA-256: ff1408ecea3672700fbfb7e8a36d50be8276062c28a585635db64a3f2f56e345
Source SHA-256: 87f0ca1318b8083ba9aab14e8d6746241eab738e3a64f6651300e0282c96e2ba
Source: standard-review-v1 (harness-log)
Reviewer session: 01a21440-231a-7583-9cad-6bd83a10579d
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: medium-high (MH1)
  • Verdict: CHANGES
  • Reviewed head: 0b6e2f2

Review report

VERDICT: CHANGES
Round: 10
Head: 0b6e2f2
Slot: 1
CI: CI is not green
Session: 01a21440-231a-7583-9cad-6bd83a10579d
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

medium-high (MH1: the shared solve and init paths change how polyalgorithms propagate initialization failure and select the next solver.)

Blocking findings

  • Blocking priorities: P2, P2
  1. [P2] The new diagonal Broyden test requires an incorrect inverse update. At test/Reactant/diagonal_tests.jl:59, the expected numerator repeats the extra factor of du in lib/NonlinearSolveQuasiNewton/src/broyden.jl:163. In one dimension the inverse secant equation determines the answer exactly. With previous inverse 1, residual change 1 and step 2, the new inverse must be 2. The dense update returned 2 and the diagonal update returned 1 on both the host and compiled CPU. This affects public solve too. For f(x) = x ./ 2 .- Float32[2, 0] from zeros with alpha=1f0 and two steps, dense good Broyden reached [4, 0] with zero residual. Diagonal Broyden stopped at [3, 0] with residual [-0.5, 0] on both paths. The formula predates this delta. The new assertion would reject its correction.

    Implementation fix: In the diagonal good-rule branch of InternalAPI.solve!, store Hy = diag(H) .* dfu in cache.J⁻¹dfu. Compute the denominator as dot(du, Hy), keep the scalar zero guard, and use (du .- Hy) .* du .* diag(H) in the numerator. In diagonal_tests.jl, check the returned matrix on the dense path as well. Add the one-component secant assertion and the two-step public solve above, with exact root, residual and return-code checks. Keep explicit zero-denominator coverage.

  2. [P2] The default auxiliary solver still prevents compiled initialization of a one-element vector. The tolerance tests at test/Reactant/first_order_tests.jl:205 use a test-specific initialization_alg method at line 138 that selects Newton. With the library's default selector, a one-step auxiliary solve for x.^2 .- 2 from Float32[1], explicit OverrideInit(abstol=0.01f0), and outer abstol=0.4f0, the host returned [1.5], outer residual [-2.5], and InitialFailure. Compilation threw Scalar indexing is disallowed while constructing Broyden's initial inverse, before the tolerance could be applied. A direct public Broyden solve on a one-element vector reached the same A[diagind(A)] .= α at lib/NonlinearSolveBase/src/utils.jl:381.

    Implementation fix: In the matrix overload of Utils.make_identity!!, construct the traced identity using a whole-matrix broadcast. I compiled A .= ifelse.(axes(A, 1) .== axes(A, 2)', α, zero(α)) with α=-2f0 and observed the exact scaled identity at sizes 1 and 2. Extend the initialization tests with a length-one vector using the ordinary auxiliary solver selector. Assert the mapped state, recomputed outer residual, InitialFailure, and zero outer steps on host and compiled paths. Cover direct dense Broyden with x ./ 2 .- 2, initial Float32[0], alpha=1f0, and a two-step limit. It should return [4], zero residual, and Success.

Non-blocking findings

None.

What I ran

  • Byte-compared the supplied delta with git diff c21984bc00bc98a0a8d7a74977980879f2689b41..HEAD. Inspected all 68 changed paths with rename detection. The benchmark workflow adds an LTS source-resolution test to a read-only pull-request job. No changed path governs deployment, merges, publishing, registration, or privileges. git diff --check origin/master...HEAD passed and git status --porcelain was empty.
  • On scratch copies of the head, ran NONLINEARSOLVE_TEST_GROUP=Reactant julia --startup-file=no --project=. -e 'using Pkg; Pkg.test()' with the supplied layered depot. Reactant 0.2.309 passed 519/519 on Julia 1.12.4 and 519/519 on Julia 1.13.3. The prior round's tolerance, accessor, restart and compilation regression cases all passed.
  • On Julia 1.12.4, the same package test entry point passed root Core (1,592) and PolyAlgorithms (554). With NONLINEARSOLVE_TEST_GROUP=Core and --project=lib/<package>, it also passed NonlinearSolveBase (570), NonlinearSolveFirstOrder (9,028) and NonlinearSolveQuasiNewton (1,078).
  • Ran the independent probes above on Julia 1.12.4. With a Newton auxiliary solver, a three-member cache starting at member 2 retained member 3, accepted new parameters, and wrapped back to member 2. Host and compiled runs returned the new target [-6, -7] with zero residual, with aliasing both on and off. An explicit initializer tolerance of 0.01 overrode the caller's 0.4 and produced InitialFailure on both paths.
  • uv run --locked python --version printed Python 3.13.13 and warned that the lock option has no effect outside a Python project. The checkout has no uv.lock or committed Julia manifest. The Julia runs resolved the checkout's package projects and local sources.

What I did not verify

I did not run on physical GPUs, build documentation, run downstream suites, or test a patched solver. The identity-broadcast probe exercised the proposed expression in isolation.

AUTHOR_GRADE: {"task":"feature","score":3,"difficulty":5,"rounds":10,"author_harness":"Codex CLI 0.170.0","author_model":"gpt-6.2-astra","note":"Both Julia versions pass all 519 Reactant assertions and the prior regression cases. An independent secant check disproves a new expected value, and the default auxiliary solver still fails to compile for a one-element vector."}

Head link: 0b6e2f2


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a21440-231a-7583-9cad-6bd83a10579d (no session URL)

ChrisRackauckas and others added 2 commits November 25, 2026 20:20
…zation

Keep the inverse times the residual change separate from the secant
denominator in the diagonal good update. Construct the scaled identity
with a whole-matrix broadcast during tracing so singleton vector solves
can initialize the dense inverse. Assemble the augmented trust-region
right-hand sides without writing through singleton views.

Exercise the returned inverse, the two-step public solves, and the
default auxiliary solver with an explicit initialization tolerance.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261126T011838Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2156f-1630-72d0-ac64-bcb6276d965b (no session URL)
Keep caller-supplied tolerance scalars independent of traced initializer
and member regions. Exercise both initializer outcomes with one compiled
executable and check Broyden updates against their full rank-one forms.
Run the Reactant CI group on Julia 1.12.4 and the release channel.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261126T045455Z-codex-gpt-6.2-astra
Agent-Session: local session 01a21635-1b9d-7c01-8771-cfd7636c9544 (no session URL)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

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

PR: #1197

Reviewed head: cdd4b72
Raw SHA-256: 204580a306eea132dfa3a66471370267081092497e93fbf01d0a7f6263720d1c
Source SHA-256: abd629c09220cdc47fef7830f52fd6982412f1bf24a29e6f0eaae0acf67705eb
Source: standard-review-v1 (harness-log)
Reviewer session: 01a216b6-96fd-7593-8493-5bd2bf9051fa
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: high (H6)
  • Verdict: CHANGES
  • Reviewed head: cdd4b72

Review report

VERDICT: CHANGES
Round: 11
Head: cdd4b72
Slot: 1
CI: CI is not green
Session: 01a216b6-96fd-7593-8493-5bd2bf9051fa
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

high (H6: .github/workflows/benchmark.yml adds execution of benchmark/test_sources.jl to the pull-request benchmark job on LTS. Keeping this workflow change requires an explicit owner decision.)

Blocking findings

  • Blocking priorities: P2

[P2] Diagonal good Broyden violates the one-dimensional inverse secant equation for a complex step. At lib/NonlinearSolveQuasiNewton/src/broyden.jl:164, dot(du, HΔf) conjugates the step. Line 166 uses the unconjugated step again in the numerator. The reference at test/Reactant/diagonal_tests.jl:59 correctly uses the adjoint, but every step in the test is real. Starting with inverse 1, step 2im and residual change im, both the host and compiled CPU update returned inverse 0. The secant equation requires 2. This also reaches public solve. For f(x) = x ./ 2 .- 2im, initial ComplexF32[0], Broyden(; update_rule=Val(:diagonal), alpha=1f0) and two iterations, the host returned [2im], residual [-im] and MaxIters. The exact second iterate is [4im] with zero residual.

Implementation fix: In the diagonal InternalAPI.solve! good-rule branch at line 166, change the numerator to (du - cache.J⁻¹dfu) * conj(du) * J⁻¹_diag inside the existing broadcast. Keep the denominator and its zero safeguard. In test/Reactant/diagonal_tests.jl, add the complex step above to the diagonal host and compiled secant checks and assert only(Hnew) * im == 2im. Add the complex target to the public two-step regression and assert the exact root, independently evaluated zero residual and Success. The same right-factor convention applies to the dense good-rule overload at line 142, where transpose(H) * conj.(du) gives the column whose transpose is du' * H. The public signature and documentation can stay as written.

Non-blocking findings

None.

What I ran

  • Compared the supplied delta byte-for-byte with git diff 0b6e2f2673523b4653bb3e47f1e9eb34dac0d575..HEAD. It covers two commits and eight files. Inspected the 68 changed paths against the merge base with rename detection. git diff --check origin/master...HEAD passed and git status --porcelain was empty.
  • On a scratch copy of the head, NONLINEARSOLVE_TEST_GROUP=Reactant julia +1.12.4 --startup-file=no --project=. -e 'using Pkg; Pkg.test()' passed 577/577 with Reactant 0.2.309 on CPU. NONLINEARSOLVE_TEST_GROUP=Core julia +1.12.4 --startup-file=no --compiled-modules=existing --project=lib/NonlinearSolveQuasiNewton -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])' passed 1,078/1,078.
  • Ran the head's default-auxiliary and two-step Broyden tests against the round-ten code. They produced 14 passes, six failures and two errors. Both real diagonal solves returned [3, 0] with residual [-0.5, 0]. Both one-element compiled cases reported Scalar indexing is disallowed. All of those cases passed on the reviewed head. The complex secant counterexample above came from a separate probe.
  • Ran the head's one-shot device-tolerance test against the parent of the tolerance fix. Compilation failed at func.return with operand #4 does not dominate this use. On the reviewed head, a separate three-member polyalgorithm probe compared host and compiled output for an omitted tolerance, mixed host/device tolerances, a shared device scalar for both keywords, a problem-level tolerance and explicit OverrideInit precedence. All 12 comparisons passed, including reuse of the input tolerance after the solve. Varying device abstol from 1f-5 to 0.1f0 on one executable changed (u, f(u), retcode) from (1.25, -2.75, InitialFailure) to (4, 0, Success).
  • Parsed test/test_groups.toml and confirmed the Reactant lanes are ["1.12.4", "1"]. The specified workflow run completed successfully. The head's check-run API returned 118 successful, three skipped and one in progress. Workflow run
  • uv run --locked python --version printed Python 3.13.13 and warned that --locked has no effect outside a Python project. The checkout has no tracked uv.lock or Julia manifest. The Julia runs used the declared projects, local package sources and the supplied layered depot.

What I did not verify

I did not run the general Julia 1 lane locally, use a physical GPU, build documentation, run downstream suites or test a patched implementation. The complex public solve was exercised on the host. The complex update kernel was exercised on both the host and compiled CPU.

AUTHOR_GRADE: {"task":"feature","score":4,"difficulty":5,"rounds":11,"author_harness":"Codex CLI 0.170.0","author_model":"gpt-6.2-astra","note":"The new tests reproduce both prior real-valued failures and the device-tolerance compiler error before their fixes. Both affected suites pass. An independent complex-step probe still breaks the corrected diagonal inverse update and the public two-step solve."}

Head link: cdd4b72


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a216b6-96fd-7593-8493-5bd2bf9051fa (no session URL)

Use the same conjugated step in the rank-one right factor and its
denominator. Check the complex secant equation for dense and diagonal
updates and the two-iteration diagonal solve on host and compiled CPU.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261126T082619Z-codex-gpt-6.2-astra
Agent-Session: local session 01a216f6-a9bc-7fd2-9f67-d9ab27cc33be (no session URL)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

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

PR: #1197

Reviewed head: 9638b3a
Raw SHA-256: de470a8023a14a4dea215276c8922015e34a61b7f06f69cfe058dd82e4e28ee5
Source SHA-256: 24be162e19d7cdc16e0cef45688cf30158ab5fe327b8a76a014edc47f48dd5b5
Source: standard-review-v1 (harness-log)
Reviewer session: 01a21736-9f44-7462-8949-2dff78f23625
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: high (H6)
  • Verdict: CHANGES
  • Reviewed head: 9638b3a

Review report

VERDICT: CHANGES
Round: 12
Head: 9638b3a
Slot: 1
CI: CI is not green
Session: 01a21736-9f44-7462-8949-2dff78f23625
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

high (H6: .github/workflows/benchmark.yml:42 adds execution of the PR head’s benchmark/test_sources.jl on the LTS benchmark runner. Split the workflow step and its benchmark changes into a separate PR. Retaining them here requires an explicit owner decision.)

Blocking findings

  • Blocking priorities: P2

[P2] Compiled Broyden still fails for a true complex scalar. The complex fixtures at test/Reactant/diagonal_tests.jl:68 and line 87 both use one-element vectors. Those pass. For the scalar problem f(x,p) = x/2 - p, starting at ComplexF32(0) with p = ComplexF32(1+2im), Broyden(; alpha=1f0) and maxiters=2, the host returned exactly 2+4im, zero residual and Success. With the same values as Reactant.ConcreteRNumber inputs, @jit failed at lib/NonlinearSolveQuasiNewton/src/reset_conditions.jl:100. The scalar reduction all(cond, du) tried to use a traced Boolean in Julia control flow. I reproduced that exception on the parent as well. Isolating the scalar update exposed a second obstacle at lib/NonlinearSolveQuasiNewton/src/broyden.jl:139: GPUCompiler reported Missing Julia object for global while lowering the broadcasted subtraction of two traced scalars, before the conjugation. A standalone compiled probe evaluated both the scalar stall predicate and the scalar good-rule formula successfully using ordinary scalar arithmetic.

Implementation fix: In _no_change_reset_traced!, evaluate cond(x) directly for a numeric step or residual change, keeping the reduction for arrays. In the numeric path of InternalAPI.solve! for BroydenUpdateRuleCache, compute the residual difference and good-rule update with scalar arithmetic and assign the new residual baseline directly. Preserve the denominator safeguard. Add true ComplexF32 host and ConcreteRNumber compiled cases to diagonal_tests.jl. Assert the scalar inverse secant equation and the public two-step root, independently evaluated residual and return code above.

Non-blocking findings

The dense complex update allocates a step-sized temporary each iteration. At lib/NonlinearSolveQuasiNewton/src/broyden.jl:143, conj(du) materializes a vector. A warmed, preallocated host update on ComplexF32 allocated 128, 1,120 and 8,264 bytes at lengths 8, 128 and 1,024. The parent allocated zero at all three lengths. The corresponding Float32 updates still allocated zero.

Implementation fix: In the dense good-rule branch, broadcast the complex conjugate into the existing du_cache before the transpose multiply. That buffer is available until line 151. Keep the direct operand for real steps. Add a warmed dense complex update to the QuasiNewton Core allocation tests and assert zero bytes and the inverse secant equation. This needs no public API or documentation change.

What I ran

  • Matched the supplied delta byte-for-byte with git diff cdd4b723b820a485d691841b2fe5c2ea30a14c6b..HEAD. Inspected the 68 changed paths against origin/master with rename detection. git diff --check origin/master...HEAD, Runic’s --check and typos on the two delta files passed.
  • Ran the head’s test/Reactant/diagonal_tests.jl on scratch copies of both revisions with Julia 1.12.4, the declared Reactant project and identical resolved manifests. The parent produced 64 passes and 12 failures. All four complex vector secant cases gave 0im instead of 2im. Both public complex vector solves stopped at [2im] with residual [-im]. The head passed 76/76.
  • Ran NONLINEARSOLVE_TEST_GROUP=Reactant julia +1.12.4 --compiled-modules=existing --project=. -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])' with the supplied layered depot. Reactant 0.2.309 on CPU passed 595/595. The same command with --project=lib/NonlinearSolveQuasiNewton passed 1,078/1,078 for Core and 20/20 for QA.
  • With a nonsymmetric complex inverse, host and compiled dense updates satisfied both the independent rank-one formula and Hnew * Δf ≈ step. The diagonal updates matched the diagonal of that formula for a diagonal initial inverse. Algebraically, transposing transpose(H) * conj(step) gives step' * H, consistent with the denominator dot(step, H * Δf). Across revisions, cmp found all 50 sampled Float32/Float64 result bit patterns identical for host scalars and host/compiled array updates, including zero-denominator cases. A separate compiled real-scalar kernel probe hit the broadcast compiler error on both revisions.
  • uv run --locked python --version printed Python 3.13.13 and warned that --locked has no effect outside a Python project. The checkout has no tracked Python lockfile or Julia manifest.

What I did not verify

I did not run the general Julia 1 lane, physical GPU, root QA, docs, benchmark workflow or downstream suites. I did not inspect remote CI or issue state, or test implementation edits.

AUTHOR_GRADE: {"task":"feature","score":4,"difficulty":5,"rounds":12,"author_harness":"Codex CLI 0.170.0","author_model":"gpt-6.2-astra","note":"The delta fixes all four complex vector secant cases and the public two-step vector solve. Both affected suites pass. The requested true-scalar Reactant probe still fails in reset and update code, and the dense complex host update adds a linear-size allocation."}

Head link: 9638b3a


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a21736-9f44-7462-8949-2dff78f23625 (no session URL)

…uffer

Evaluate scalar stall tests directly and install the numeric inverse and
descent step by assignment. Use the conjugated step in the good Broyden
update and reuse the existing work vector for dense complex updates.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.2-astra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261126T105717Z-codex-gpt-6.2-astra
Agent-Session: local session 01a21780-f420-7b20-ba5c-392c374b0cc9 (no session URL)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

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

PR: #1197

Reviewed head: 1389485
Raw SHA-256: 762bca266f435f951bb4443eb83cb7453d10a361432bdc787f2d5fc244a92852
Source SHA-256: d4ab80b9d9245fcda2cee1bb1adcd31548016e3b190892e3392fa9b31d294255
Source: standard-review-v1 (harness-log)
Reviewer session: 01a217d0-9275-72d3-b8ce-e52067a711d5
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: high (H6)
  • Verdict: CHANGES
  • Reviewed head: 1389485

Review report

VERDICT: CHANGES
Round: 13
Head: 1389485
Slot: 1
CI: CI is not green
Session: 01a217d0-9275-72d3-b8ce-e52067a711d5
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

high (H6: .github/workflows/benchmark.yml:42 adds execution of the PR head’s benchmark/test_sources.jl on the LTS runner. Retaining that workflow step requires an explicit owner decision.)

Blocking findings

  • Blocking priorities: P2

[P2] The new scalar bad-Broyden update violates the inverse secant equation for complex residuals. At lib/NonlinearSolveQuasiNewton/src/broyden.jl:144, the right factor is dfu. With the default Euclidean norm, it must be conj(dfu) so that multiplying the update by dfu cancels the squared-norm denominator. For H = 1, dfu = im and du = 2im in ComplexF32, the host and compiled kernels both returned Hnew = 0. The secant equation requires exactly Hnew = 2. In the public solve for f(x,p) = x/2 - p, starting at zero with p = 2im, alpha = 1f0, update_rule = Val(:bad_broyden) and maxiters = 2, both stopped at 2im with residual -im and MaxIters. The good rule reached 4im with zero residual and Success. The parent also exhibited the bad-rule error on the host. The new scalar specialization now produces that result under compilation.

Implementation fix: Set right = conj(dfu) in the bad-rule branch of the numeric InternalAPI.solve! method in broyden.jl, preserving its denominator guard. In test/Reactant/diagonal_tests.jl:102, parameterize the scalar update and public solve over both rules. Run the case above on host numbers and compiled ConcreteRNumber inputs. Assert Hnew * im == 2im, the exact root 4im, independently recomputed and reported zero residuals, and ReturnCode.Success. Both scalar callers share this method.

Non-blocking findings

None.

What I ran

  • The supplied delta matched git diff 9638b3a..HEAD byte for byte. I checked all 69 paths in git diff --name-status -M origin/master...HEAD. There were no renames. AGENTS.md is identical to the base. The delta touches five QuasiNewton source and test files. The termination and tolerance machinery in lib/NonlinearSolveBase and its Reactant regression files are byte-identical to the parent. The five delta files passed Julia Runic’s --check and typos. The full diff passed git diff --check.
  • On scratch copies with Julia 1.12.4 and the supplied layered depot, I ran NONLINEARSOLVE_TEST_GROUP=Reactant julia +1.12.4 --compiled-modules=existing --project=. -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'. Reactant integration passed 605/605. The same command with --project=lib/NonlinearSolveQuasiNewton passed 1,084/1,084 for Core and 20/20 for QA.
  • I ran the head’s diagonal test file against both revisions with identical resolved Reactant 0.2.309 environments on CPU. The parent recorded 81 passes and two errors: a missing Julia global in the compiled scalar update and a traced Boolean used in host control flow in the public solve. The head passed 86/86.
  • My independent scalar probe obtained the exact two-step good-rule root and zero residual on host and compiled Float32, Float64 and ComplexF32. A nonsymmetric complex dense inverse matched the rank-one formula and satisfied the secant equation on both backends. Across revisions, cmp matched all 20 sampled host-scalar and host/compiled-array result records, including the pre-existing host bad-rule result.
  • A warmed, preallocated dense good-rule update on ComplexF32 allocated 0, 0, 0 bytes at lengths 8, 128 and 1,024. The parent allocated 128, 1,120, 8,264 bytes. All six updates satisfied the inverse secant equation.
  • uv run --locked python --version printed Python 3.13.13 and warned that --locked has no effect outside a Python project. The checkout has no Python lockfile or Julia manifest.

What I did not verify

I did not run the other Julia lanes, physical GPU, downstream, docs or benchmark jobs. I did not inspect remote CI or issue state, so I cannot attribute a remote failure or verify a deferral.

AUTHOR_GRADE: {"task":"feature","score":4,"difficulty":5,"rounds":13,"author_harness":"Codex CLI 0.170.0","author_model":"gpt-6.2-astra","note":"The prior scalar good-Broyden blocker and dense allocation are resolved, with passing regressions and affected suites. The new complex scalar bad-Broyden branch still returns an inverse that violates the secant equation on host and under compilation."}

Head link: 1389485


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a217d0-9275-72d3-b8ce-e52067a711d5 (no session URL)

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.169.0
Agent-Model: gpt-6.1-terra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261126T132842Z-codex-gpt-6.1-terra
Agent-Session: local session 01a2180b-7562-7d30-9728-3fe53c92919a (no session URL)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

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

PR: #1197

Reviewed head: 919e2d5
Raw SHA-256: 4b4e7159c2a5590e6318690f84f415e6205408ce4d535990b99288d88a723ffe
Source SHA-256: 3b9111c4f5278afe27b75baafee87e69ebecad3999363e69973dae6332c4017e
Source: standard-review-v1 (harness-log)
Reviewer session: 01a2187e-fd68-7443-91c7-4636c33342c2
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: high (H6)
  • Verdict: MERGE
  • Reviewed head: 919e2d5

Review report

VERDICT: MERGE
Round: 14
Head: 919e2d5
Slot: 1
CI: CI is not green
Session: 01a2187e-fd68-7443-91c7-4636c33342c2
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

high (H6: .github/workflows/benchmark.yml:42 executes the PR head’s benchmark/test_sources.jl on the LTS runner. Keeping that workflow change requires an explicit owner decision.)

Blocking findings

  • Blocking priorities: none

Non-blocking findings

The dense bad-Broyden update has a pre-existing complex-vector secant error. At lib/NonlinearSolveQuasiNewton/src/broyden.jl:171, the right factor uses an ordinary transpose. With a one-element vector, identity inverse, dfu = [im] and du = [2im] in ComplexF32, both parent and head returned Hnew = [0;;]. The public two-step solve for x/2 - p stopped at [2im] with residual [-im] and MaxIters on both revisions. The new loop preserves the parent’s result. The corrected scalar method reaches 4im.

Implementation fix. In a separate fix, use adjoint(Utils.safe_vec(cache.dfu)) for the dense bad-rule right factor in InternalAPI.solve!, preserving the denominator guard and preallocated update. Extend the array cases in test/Reactant/diagonal_tests.jl with the one-element complex vector and Val(:bad_broyden). Assert the inverse secant equation, [4im], zero residual and Success on host and under compilation. Exercise both rules in the existing dense allocation test. The public solver already dispatches through this method.

What I ran

  • Compared the supplied delta byte-for-byte with git diff HEAD^ HEAD. The single commit changes only lib/NonlinearSolveQuasiNewton/src/broyden.jl and test/Reactant/diagonal_tests.jl. The Core allocation assertions are unchanged and unconditional. I checked all 69 paths in git diff -M --name-status origin/master...HEAD. There are no renames, and AGENTS.md matches the base. Julia Runic, typos, git diff --check and a scan of added lines for local paths passed. The checkout remained clean.
  • Ran the head’s diagonal file on both revisions with byte-identical resolved manifests, Julia 1.12.4 and Reactant 0.2.309 on CPU. The parent passed 98/120, with all 22 failures in the scalar tests. The head passed 120/120. For dfu = im, du = 2im, the head returned Hnew = 2 and the public solve returned 4im, zero residual and Success on host and compiled numbers under both rules.
  • The committed scalar fixtures use mixed and purely imaginary ComplexF32 values. My independent probe also exercised actual Float32 inputs and zero denominators on both backends. It passed 60/60 scalar assertions on the head, against 44/60 on the parent. A separate good-rule probe compared real and complex dense and diagonal updates to the analytical rank-one formula using a nonsymmetric dense inverse. All 12/12 assertions passed, including the dense secant checks.
  • Ran all 14 QuasiNewton Core testsets with NONLINEARSOLVE_TEST_GROUP=Core and Pkg.test() in scratch copies. On Julia 1.10.12 I developed the local NonlinearSolveBase and SciMLJacobianOperators sources before testing. On 1.12.4 I used --compiled-modules=existing for Julia and the test subprocess. Full-suite totals were 1,417/1,417 on LTS and 1,084/1,084 on 1.12.4, including Broyden-file subtotals of 816 and 600. The corresponding base totals were 1,411/1,411 and 1,078/1,078. All four runs had zero broken tests.
  • The parent’s LTS Core run stopped in the Broyden file at 813 passed, 3 failed. Each failure evaluated 16 == 0. Three independent warmed measurements at each of n = 8, 128, 1024 gave 16 bytes on the LTS parent and 0 bytes on the head. On 1.12.4 both revisions gave 0 bytes. Every measured good-rule update satisfied the inverse secant equation. The LTS CI logs reproduce the same before/after. Parent Core job · Head Core job
  • Ran NONLINEARSOLVE_TEST_GROUP=Reactant julia +1.12.4 --compiled-modules=existing --project=. -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'. The full Reactant group passed 639/639. uv run --locked python --version printed Python 3.13.13 and warned that --locked has no effect outside a Python project. The checkout has no uv.lock or Julia manifest.
  • Inspected both solver CI attempts. Attempt 1 aborted with GC error (probable corruption) and signal 6 at test/Adjoint/adjoint_tests__item3.jl:24, inside Enzyme reverse differentiation of an explicitly selected NewtonRaphson() solve. That test never selects Broyden. The same macOS LTS job on the same head and Enzyme 0.13.221 passed the exact gradient test 1/1 on retry. This identifies an intermittent Julia/Enzyme abort in that lane. After completion, gh run view 45838310585 -R SciML/NonlinearSolve.jl --log-failed returned empty output and the solver and sublibrary runs both reported success. Original abort · Passing macOS retry · Sublibrary CI
  • The remaining head workflow with a non-success conclusion was Dependabot Auto-merge, which reported startup_failure. I verified the same conclusion for that workflow on an unrelated head. Head run · Unrelated run

What I did not verify

I did not reproduce the GC abort locally or isolate its underlying memory fault. I did not rerun QA, docs, benchmarks, GPU or downstream tests locally, or measure allocations on Julia versions beyond 1.10.12 and 1.12.4.

AUTHOR_GRADE: {"task":"feature","score":5,"difficulty":5,"rounds":14,"author_harness":"Codex CLI 0.169.0","author_model":"gpt-6.1-terra","note":"The scalar bad-Broyden regression fails on the parent and passes on host and compiled numbers at the head. The LTS allocation failure reproduces and is fixed without weakening its assertions. Both Core suites and the full Reactant group pass."}

Head link: 919e2d5


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a2187e-fd68-7443-91c7-4636c33342c2 (no session URL)

ChrisRackauckas and others added 2 commits November 26, 2026 22:43
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6.1-terra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261127T034246Z-codex-gpt-6.1-terra
Agent-Session: local session 01a21b19-4dbb-7af1-a63b-9087ade0bda1 (no session URL)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.172.0
Agent-Model: gpt-6.1-terra
Agent-Job: SciML__NonlinearSolve.jl__1197--20261128T034122Z-codex-gpt-6.1-terra
Agent-Session: local session 01a2203f-85bb-7200-b092-268afe05ce16 (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