Skip to content

SimpleNonlinearSolve: single branchless loops that trace under Reactant - #1213

Draft
ChrisRackauckas-Claude wants to merge 79 commits into
SciML:masterfrom
ChrisRackauckas-Claude:reactant-simple
Draft

ChrisRackauckas-Claude wants to merge 79 commits into
SciML:masterfrom
ChrisRackauckas-Claude:reactant-simple

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Aug 29, 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: Claude Code (version unknown) · Model: claude-fable-5
Conversation: https://claude.ai/code/session_016LsC6pp9z6s5EABX9DnVjE

Draft. Stacked on #1197 (NonlinearSolveBase/first-order Reactant support, unmerged — the diff versus master therefore contains that stack too). This PR's own commits: bfffd5d9c + 67e5133a2 (Simple* branchless traced loops), 99fbd0293 (merge of current master), e11385d16 (ReactantCore 0.1.25 compat floor).

What changed and why

Each SimpleNonlinearSolve iteration (SimpleNewtonRaphson, SimpleTrustRegion, SimpleBroyden, SimpleKlement, SimpleHalley) is now written once as a branchless loop that runs unchanged on the host and under Reactant.@compile:

  • for _ in 1:maxiters with solved && return becomes ReactantCore.@trace track_numbers = false while (!solved) & (iterations < maxiters); the "initial guess is already a root" early return is subsumed (the loop does not execute and simple_solution reports Success). @trace is a compile-time no-op outside Reactant.
  • Decisions that used to return or branch (SimpleHalley's factorization failure, SimpleTrustRegion's shrink-threshold exit and step acceptance, SimpleKlement's Jacobian reset) are loop conditions or ifelse selections. dogleg_method!! keeps its two host early-outs behind !within_compile() with the selection as the fallthrough.
  • Utils.init_loop_state promotes the return code and counter with NonlinearSolveBase.maybe_traced and makes the loop-carried arrays distinct; Utils.fresh re-applies that after check_termination (whose best-iterate result aliases the termination cache) and after @bb copyto! (which rebinds rather than copies for traced arrays). Both are no-ops on the host.
  • Utils.simple_solution builds the NonlinearSolution from solved with ifelse/select; the previous _build_simple_solution, _copy_for_reactant, reactant.jl and the nonlinear_solution_new_alg shadow-solution hack are removed, as is the Base.@noinline on the safe-best check_termination (its tests pass on 1.10 without it).

SimpleTrustRegion's host loop now forms the candidate Jacobian on every iteration and selects it (previously only accepted steps recomputed it). The result-type assertions in simple_solution exist because SimpleTrustRegion with autodiff = nothing has a run-time-typed Jacobian (prepare_jacobian returns a non-concrete DIExtras), which is pre-existing but previously never reached the return type; with them @inferred solve(...) holds on 1.10 and 1.12.

Diff on top of the core PR: 9 files, +237/−102.

Verification

Same environment as the core PR (Reactant#3232, SciMLBase#1563, DI 571fc178), Julia 1.12.4 unless noted.

Reactant group with the full matrix (Simple solvers included):

Test Summary:        | Pass  Total     Time
Reactant Integration |  147    147  8m42.9s

SimpleNonlinearSolve's own groups with this branch's NonlinearSolveBase developed in:

GROUP=Core  Julia 1.10.11   Testing SimpleNonlinearSolve tests passed
GROUP=Core  Julia 1.12.4    Testing SimpleNonlinearSolve tests passed
GROUP=QA    Julia 1.12.4    Testing SimpleNonlinearSolve tests passed

Before the select/simple_solution result-type assertions, the 1.10 Core group failed @inferred solve(prob, SimpleTrustRegion()) in the root-finding snippet (return type NonlinearSolution{_A, _B, _C, _D, …}); with them it passes on both versions.

Formatted with Runic 1.10.0; typos clean.

Not verified

  • SimpleDFSane and SimpleLimitedMemoryBroyden are unchanged here (SimpleDFSane's line search branches on traced values and is still unsupported under Reactant; limited-memory Broyden already traced).
  • GPU groups; GROUP=Everything.

🤖 Generated with Claude Code (model: claude-fable-5) on behalf of Chris Rackauckas. Session: https://claude.ai/code/session_016LsC6pp9z6s5EABX9DnVjE

Prior agent assessment and fix reports for the pre-rebase heads were relocated verbatim to this PR's comments (2026-11-22) to keep reviews independent of them.

Risk assessment

  • Risk: high — this PR rides the same shared-solver-loop rewrite as the unmerged stack under Trace the nonlinear solver loops under Reactant #1197, and the Simple* iteration loops it rewrites run in downstream initialization solves.
  • Blast radius: 66 files versus master including the Trace the nonlinear solver loops under Reactant #1197 stack (NonlinearSolveBase/FirstOrder/Simple/QuasiNewton/SpectralMethods/SCC). This PR's own surface: branchless traced Simple* loops in SimpleNonlinearSolve, the Reactant test group, and a ReactantCore 0.1.25 compat floor for SimpleNonlinearSolve.
  • Evidence: CI on head e11385d16: 113 pass, 1 fail = CUDA (directly confirmed failing on current master push run 44568335433), 1 skipped matrix placeholder. GROUP=Reactant 149/149; root GROUP=QA 28/28; SimpleNonlinearSolve QA 20/20. All four minimum-version downgrade Core groups pass on Julia 1.10.14; the compat floor is justified by a nested @trace reproducer that fails on every ReactantCore 0.1.21–0.1.24 and passes on 0.1.25.
  • Independent review: a fresh-session counted review by an escalation-tier model is running at the time of this edit; earlier agent assessments are in the relocated comment.
  • Merge: needs human review — SciML org policy; Trace the nonlinear solver loops under Reactant #1197 must land first (stacked PR).

🤖 Posted by an AI agent — harness: Claude Code · model: qwen3.8-flash-next
Conversation: local session topic-reactant-work (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 f3ae789)

Merged the updated parent at 97a1fda0b. Both singular Halley cases now return Unstable with the original iterate and finite residual. The factorization check uses the determinant sign, including for small nonsingular pivots. Host Broyden exits before allocating its workspace for an exact initial root. Its compiled full step also works when the optional line-search cache is absent. The generic and static low-rank limited-memory iterations report an actionable ArgumentError during compilation. The two-component test exercises the dense fallback.

The parent supplies the registered DifferentiationInterface array-AD guard and both termination corrections. The safe-best regression returns the first iterate with unit residual (about −20.464836). SimpleKlement returns MaxIters for a nonfinite residual under plain absolute-norm termination. The full group used registered DifferentiationInterface 0.7.22 and Reactant 0.2.308.

SimpleTrustRegion evaluates the candidate Jacobian when the trial is accepted and another iteration is needed. The dense limited-memory fallback uses Utils.nonlinear_solution_new_alg to retain the requested algorithm in the solution. ConstructionBase and ReactantCore, the new hard dependencies of NonlinearSolveBase, both use the MIT license.

Verification

The same focused suite on the original head and this head used Julia 1.13.3, registered DI 0.7.22 and ReactantCore 0.1.26. Integer and rational exact roots raised MethodError: eps before the fix. The 512-element exact-root allocation fell from 4,236,256 to 4,168 bytes. On the original head, Halley reported success below the residual threshold and returned NaNs above it. The low-rank solve raised a traced-boolean TypeError and Newton array AD raised a scalar-indexing error. A separate original-head run with ReactantCore 0.1.27 reproduced UndefVarError: ls_cache on the first Broyden iteration.

julia +1.13.3 --compiled-modules=existing --project="$before" "$REGRESSIONS"
Review regressions | 28 pass, 15 fail, 2 errors
julia +1.13.3 --compiled-modules=existing --project="$after" "$REGRESSIONS"
Review regressions | 47  47

The validation environments load the local sublibraries. The Julia 1.13.4 CPU integration used four threads and stock packages. It ran the focused checks and a garbage collection before entering the ordinary group runner. Project paths and the focused regression script are represented by shell variables.

GROUP=Reactant julia --compiled-modules=existing --project="$after" -e 'include(ENV["REGRESSIONS"]); flush(stdout); GC.gc(); include("test/runtests.jl")'
Review regressions | 47  47  3m30.3s
Reactant Integration | 322  322  8m21.0s

GROUP=Core julia +1.10 --compiled-modules=no --project="$env110" lib/SimpleNonlinearSolve/test/runtests.jl
Kwargs Propagation | 9  9
35,756 passed and 8 existing broken across the group.
GROUP=Core julia +1.12 --compiled-modules=existing --project="$env112" -e 'using Pkg; Pkg.test("SimpleNonlinearSolve"; julia_args=["--compiled-modules=existing"])'
Testing SimpleNonlinearSolve tests passed
35,643 passed and 4 existing broken across the group.

GROUP=QA julia +1.10 --project="$env110" lib/SimpleNonlinearSolve/test/runtests.jl
QA | 18  18  1m33.0s
GROUP=QA julia +1.12 --compiled-modules=existing --project="$env112" lib/SimpleNonlinearSolve/test/runtests.jl
QA | 20  20  3m14.4s
GROUP=QA julia +1.13.3 --compiled-modules=existing --project=. -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'
QA | 28  28

julia --project=@runic -m Runic --check <changed Julia files>
git diff --cached --unified=0 HEAD | sed -n '/^+++ /d;s/^+//p' | typos -
git diff --cached --check
All exited 0.

Some Julia 1.13.3 and 1.13.4 CPU runs encountered the parent’s reproducible XLA callback/garbage-collection deadlock. The CUDA CI job encountered the same GPUCompiler deprecation assertion on both the reviewed head and master. I had no GPU for local validation. Downstream packages and the Everything group were outside this run. Parent investigation · PR CUDA log · Master CUDA log

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 01a208e5-fb5a-7ea2-9d12-deb27c3fa37d (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 f9bd73d)

Merged the fixed parent from reactant-jit-solve. The merge has first parent f3ae78971 and second parent 7c408456a. The counted review and the tests below identify the individual cases.

Finding Before Verified result
1. Aliased polyalgorithm The compiled winner took the caller's initial [2,2] on success and the last candidate's [3,3] after two failures. Both the solution and caller buffer retain [1,1], with zero residual and the winning Success or MaxIters code. Both two-component cases passed 8/8.
2. Simple Newton and Gauss–Newton Both the host and compiled solvers returned Success at 50.004997, reported -0.009999, and had a recomputed residual of 24.994997. Both check the initial iterate, evaluate each updated residual before testing it, and refresh the Jacobian only for a further step. At tolerance 0.01f0 both retain 0.01f0. The host and compiled residual and tolerance checks passed 28/28. The host checks for zero, one, and exhausted iteration budgets and Jacobian call counts passed 32/32.
3. Public Newton step Compiled stepping returned zeros, residuals of −2, and one step even with zero budget. From two ones, budget one gives two values of 1.5 and residuals of 0.25. Budget zero retains the ones, residuals of −1, and zero steps. Host and compiled passed 12/12.
4. Initialization failure A compiled scalar cache marked InitialFailure advanced from 2 to 1 in one step and returned success. Newton, cached polyalgorithm and no-init solves retain the original two-component iterate, residual, and InitialFailure. Jacobian evaluation and available step counters stay zero. Passed 30/30, plus the scalar replay.
5. Dense Newton tutorial The reviewed tutorial HLO contained reactant_julia_callback. The hosted group was cancelled at its two-hour limit. The merged parent lowers the default dense solve on device. The cold tutorial checks the HLO, Success, both roots against sqrt(2.0f0), and the materialized residual.
6. Endpoint codes Both exact endpoint codes fell through to the second root. Each returns the first root with its exact endpoint code. StalledSuccess still advances to the next member. Each case passed 8/8.
7. SimpleBroyden The constant rational residual triggered DivideError during a rank-one update after acceptance. The guarded update and buffer writes preserve [1,99//100], residual [0,1//100], and Success (3/3). The compiled full-step regression also passed 3/3.
8. Nested arrays and const fields Updating one entry of [u,u] changed its sibling to [1,2]. The reviewed const/cycle fixtures errored. The traversal visits assigned Julia array elements with cycle protection. The second entry retains [-0.0,1.0]; the first becomes [1,2]. Both parent const-field fixtures passed 5/5.
9. SCC callback histories Decorators around concrete-signature wrappers failed with MethodError: Cannot convert. Mixed direct signatures also failed. The callback receives a history convertible to its declared element type. Matching direct wrappers retain the existing view. The shared two-block fixture passed 140/140 across both signatures, decorators, mixed callbacks, and despecialized parameters, with an independent five-equation reference root.

The SCC fixture consolidation retains the stored-element-type and warmed compile-time checks. AGENTS.md now asks for Core and QA in each changed sublibrary and verification of the resolved source paths. The benchmark workflow still requires an owner decision.

Verification

The focused drivers execute the committed regression assertions in the repository test environments. The numerical and nested-array baseline used the merge before the child changes. The parent-overlap baseline used the reviewed child head. In the commands, shell variables identify these checkouts, test targets and focused drivers.

export JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=4 OPENBLAS_NUM_THREADS=1 JULIA_PKG_PRECOMPILE_AUTO=0
julia +1.12.7 --compiled-modules=existing --startup-file=no --project="$merged/test/Reactant" "$child_probes"
Child regressions                                              |   13    17      1     31  2m26.4s
julia +1.12.7 --compiled-modules=existing --startup-file=no --project=test/Reactant "$fixed_probes"
Child regressions |   33     33  2m25.3s
Simple Newton checks convergence before refreshing the Jacobian |   32     32  0.3s
Parent overlap                                                   |  120    120  1m42.6s
julia +1.13.3 --compiled-modules=existing --startup-file=no --project="$reviewed/test/Reactant" "$overlap_probes" baseline
Parent overlap                                                   |   57    23      2     82  1m12.6s
julia +1.13.3 --compiled-modules=existing --startup-file=no --project="$reviewed/test/Reactant" "$initialization_and_hlo"
Reviewed initialization and Jacobian                                    |   14    23     37  56.5s
julia +1.13.3 --compiled-modules=existing --startup-file=no --project=test/Reactant "$initialization_and_hlo"
Reviewed initialization and Jacobian                                    |   37     37  1m08.3s
julia +1.13.3 --compiled-modules=existing --startup-file=no --project=test/Reactant "$tutorial_under_allocation_pressure"
docs/tutorials/nonlinear_solve_gpus.md Reactant NewtonRaphson example |    4      4  1m01.7s
batches[] - start = 2879

The SCC before/after runs used the same final shared fixture. Before the fix, a decorated concrete-signature callback raised a view-conversion error. After the fix, each wrapper received its declared view and the results matched the independently solved coupled system.

GROUP=Core julia +1.13.3 --compiled-modules=existing --startup-file=no --project="$merged/lib/SCCNonlinearSolve" -e 'using Pkg; Pkg.test()'
ERROR: LoadError: Some tests did not pass: 100 passed, 0 failed, 5 errored, 0 broken.
GROUP=Core julia +1.13.3 --compiled-modules=existing --startup-file=no --project=lib/SCCNonlinearSolve -e 'using Pkg; Pkg.test()'
Vector-form SCCNonlinearProblem with FunctionWrappers |  140    140  7.3s
Testing SCCNonlinearSolve tests passed

Both CPU versions ran the complete root Reactant group. The test targets match the root project and include its test dependencies. The resolved solver sources point into the checkout.

JULIA_LOAD_PATH="@:$root_target_112:@stdlib" NONLINEARSOLVE_TEST_GROUP=Reactant julia +1.12.7 --compiled-modules=existing --startup-file=no --project="$root_target_112" test/runtests.jl
Reactant Integration |  481    481  19m01.4s
JULIA_LOAD_PATH="@:$root_target_113:@stdlib" NONLINEARSOLVE_TEST_GROUP=Reactant julia +1.13.3 --compiled-modules=existing --startup-file=no --project="$root_target_113" test/runtests.jl
Reactant Integration |  481    481  14m28.1s
NONLINEARSOLVE_TEST_GROUP=Reactant julia +1.13.3 --compiled-modules=existing --startup-file=no --project=. -e 'using Pkg; Pkg.test()'
Reactant Integration |  481    481  15m56.8s

The Core and QA invocations used the following package projects.

for pkg in . lib/SimpleNonlinearSolve lib/SCCNonlinearSolve lib/NonlinearSolveBase lib/NonlinearSolveFirstOrder; do
  GROUP=Core julia +1.12.7 --compiled-modules=existing --startup-file=no --project="$pkg" -e 'using Pkg; Pkg.test()'
  version=1.12.7
  if [ "$pkg" = . ]; then version=1.13.3; fi
  GROUP=QA julia "+$version" --compiled-modules=existing --startup-file=no --project="$pkg" -e 'using Pkg; Pkg.test()'
done
Testing SimpleNonlinearSolve tests passed
QA            |   20     20  4m23.4s
Testing SCCNonlinearSolve tests passed
QA            |   20     20  3m24.5s
Testing NonlinearSolveBase tests passed
QA            |   20     20  42.1s
Testing NonlinearSolveFirstOrder tests passed
QA            |   20     20  5m13.2s
Testing NonlinearSolve tests passed
QA            |   28     28  2m16.8s
julia +1.12.7 --compiled-modules=existing --startup-file=no --project=@runic -m Runic --inplace "${changed_julia_files[@]}"
julia +1.12.7 --compiled-modules=existing --startup-file=no --project=@runic -m Runic --check "${changed_julia_files[@]}"
git diff --cached --unified=0 | sed -n '/^+++ /d;s/^+//p' | typos -
git diff --cached --check
Runic, typos and git diff --check exited 0 with empty output.

CUDA had the same GPUCompiler deprecation assertion on the reviewed PR and master (21 passed, 1 failed in both). GPU hardware, downstream packages, prerelease Julia and the full Everything matrix were outside this verification. The parent documents the Julia 1.12.4 GPUCompiler limitation. PR CUDA job · Master CUDA job · Reviewed Reactant timeout · Parent 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 01a2124d-cd0c-7873-8e13-aee5a138e440 (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 60e7b46)

Merged the fixed parent into the reviewed child. The merge is 737fc385b. The two parent-covered cases were tested on both sides of this merge. The child changes were tested against the merged baseline. Round-two findings

Finding Before Verified behavior
1. Dense Newton Compiled Newton exhausted three iterations at zero with both residuals −1. With the parent’s pivoted LU, host and device returned Success at [1, 134217728] with both recomputed residuals exactly zero. The Newton-path test covers the reviewer’s Float32 power of two. The linsolve_identity!! caller solving A X = I retains the parent's SVD fallback for singular square matrices. The singular generalized inverse and the small nonsingular pivot both passed.
2. Julia 1.12.4 broadcasts The reduced augmented RHS raised a missing-global error before the merge. On the merge, scalar Simple Newton and diagonal cubic Broyden still raised missing-global errors in GPUCompiler. The parent supplies the damping square-root hoist and the exact [0, 0, 1, 2] check. This child hoists the guarded Broyden denominators and subtracts scalar Newton steps directly. The trust-region, diagonal cubic and scalar Simple Newton tests passed on 1.12.4 and 1.13.3.
3. Simple Newton Jacobian The compiled counter reported one for an initially acceptable residual and for a zero budget, for both problem types. The loop evaluates the derivative once per attempted step and reuses storage on the host. Host and device counts were 0, 0 and 1. Both solvers returned the expected point, residual and return code in all three cases, including the one-step control at 1.25.
4. SCC callback view The direct transfer succeeded. Its decorated form threw a MethodError when it received an SCCHistory. Ordinary callbacks receive a SubArray over SCC-owned storage. Typed FunctionWrappers can convert the view to their declared history. Both ordinary callbacks transferred the same first-block value and matched the independent five-equation solution. The mixed and despecialized wrapper cases also passed.

Both reviewed-head Trim jobs failed on JET’s captured if_result#242 in host finalization. Both corresponding checks passed on the latest master push. The parent supplies the finalization fix. The complete Linux Trim group passed locally. Reviewed CI · Master CI

Verification

The focused driver reads CHILD_TREE to locate the regression assertions. The shell variables below identify the reviewed and merged checkout test projects, their focused drivers, and the Julia runtime used by Trim. The focused drivers execute the committed assertions.

export JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=4 OPENBLAS_NUM_THREADS=1 JULIA_PKG_PRECOMPILE_AUTO=0
PARENT_ONLY=1 julia +1.12.4 --compiled-modules=existing --startup-file=no --project="$reviewed/test/Reactant" "$focused_driver"
Round two                                     |    7     7      1     15  6m11.0s
julia +1.12.4 --compiled-modules=existing --startup-file=no --project="$merged/test/Reactant" "$focused_driver"
Round two                                                        |   59     4      2     65  7m58.6s
Parent coverage | 15 passed
julia +1.12.4 --compiled-modules=existing --startup-file=no --project=test/Reactant "$child_driver"
Round two | 78  78  6m57.5s
GROUP=Core julia +1.13.3 --compiled-modules=existing --startup-file=no --project="$merged/lib/SCCNonlinearSolve" -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'
Some tests did not pass: 143 passed, 0 failed, 1 errored, 0 broken.
GROUP=Core julia +1.13.3 --compiled-modules=existing --startup-file=no --project="$scc_test_target" lib/SCCNonlinearSolve/test/runtests.jl
Vector-form SCCNonlinearProblem with FunctionWrappers | 146  146  9.7s
"$julia_1_13_4" --startup-file=no --project=test/trim -e 'include("test/trim/runtests.jl")'
Clean implementation (non-trimmable) | 2  2  1m52.3s
Trimmable implementation | 2  2  31.1s
Run trim | 4  3  7  2m47.9s

All three CPU Reactant groups ran to completion with local solver sources, Reactant 0.2.309 and GPUCompiler 2.10.0. Julia 1.12.4 had one remaining error in the scalar autodiff Newton/default test. The stack reaches a subtraction broadcast over two traced scalars. The parent's standalone reproducer imports only Reactant and compiles difference(x) = x .- x for a ConcreteRNumber. A fresh 1.12.4 process reported Missing Julia object for global 'jl_global_48335'. The same input returned 0.0f0 on 1.12.7. All requested 1.12.4 cases passed, including the 48 derivative-counter checks. Julia backport

for v in 1.12.4 1.12.7 1.13.3; do
  JULIA_LOAD_PATH="@:$root_test_target:@stdlib" NONLINEARSOLVE_TEST_GROUP=Reactant julia "+$v" --compiled-modules=existing --startup-file=no --project="$root_test_target" test/runtests.jl
done
1.12.4  Reactant Integration | 595 1 596 26m15.4s
1.12.7  Reactant Integration | 604 604 31m00.0s
1.13.3  Reactant Integration | 604 604 23m25.4s

GROUP=Core julia +1.12.7 --compiled-modules=existing --startup-file=no --project="$root_test_target" test/runtests.jl
FastShortcutHomotopyPolyalg + homotopy initialization_alg | 12  12  33.1s
GROUP=QA julia +1.13.3 --compiled-modules=existing --startup-file=no --project=. -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'
QA            |   28     28  2m07.2s

for pkg in SCCNonlinearSolve SimpleNonlinearSolve NonlinearSolveQuasiNewton NonlinearSolveBase; do
  for g in Core QA; do
    GROUP="$g" julia +1.12.7 --compiled-modules=existing --startup-file=no --project="lib/$pkg" -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'
  done
done
Testing SCCNonlinearSolve tests passed (Core)
SCCNonlinearSolve QA            |   20     20  2m10.4s
Testing SimpleNonlinearSolve tests passed (Core)
SimpleNonlinearSolve QA            |   20     20  4m29.8s
Testing NonlinearSolveQuasiNewton tests passed (Core)
NonlinearSolveQuasiNewton QA            |   20     20  2m57.2s
Testing NonlinearSolveBase tests passed (Core)
NonlinearSolveBase QA            |   20     20  37.9s

GROUP=Alloc JULIA_LOAD_PATH="@:$root_test_target:@stdlib" julia +1.13.3 --compiled-modules=existing --startup-file=no --project="$root_test_target" lib/SimpleNonlinearSolve/test/runtests.jl
Allocation Tests | 18  18  53.7s
SimpleHomotopySweep Allocation Tests | 2  2  2.4s
julia +1.13.3 --compiled-modules=existing --startup-file=no --project=docs -e 'using Pkg; Pkg.resolve(); include("docs/make.jl")'
HTMLWriter: rendering HTML pages.
Documenter could not auto-detect the building environment. Skipping deployment.
julia +1.12.7 --project=@runic -m Runic --inplace "${changed_julia_files[@]}"
julia +1.12.7 --project=@runic -m Runic --check "${changed_julia_files[@]}"
git diff --cached --unified=0 | sed -n '/^+++ /d;s/^+//p' | typos -
git diff --cached --check
# Format, spelling and whitespace checks exited 0.

The version list in the root group table configures hosted GitHub runs. Expanding that matrix and accepting the existing H6 mechanism require an owner decision. GPU hardware, downstream packages and local macOS execution were outside this CPU validation.

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 01a2132d-4923-7203-9309-18780dfb9f88 (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 9f697a4)

The compiled Simple Newton and Gauss–Newton methods now build analytic Jacobians within the active step. The SCC history view exposes its dense backing storage so decorated callbacks accepting a StridedVector receive the same data as direct callbacks. The parent at 0b6e2f267 supplies the initialization tolerance, cache accessor and scalar stall fixes. It was already included at merge 5c05de200. Round-three findings

On Julia 1.12.4, the merged baseline reported 621 passed, 0 failed, 4 errored in root Reactant. The four errors named the traced Jacobian slot. The same group passed 753/753 on this head. The SCC transfer test went from 151 passes and one decorated-transfer MethodError to 156/156. The prior run also verified zero Jacobian callbacks at an acceptable initial iterate and one at an active initial iterate with the same compiled executable. Both analytic algorithms returned the active iterate [1.25f0] and residual [0.5625f0].

Remaining Core and QA groups

Sublibrary Group Julia Passed Broken
NonlinearSolveFirstOrder Core 1.12.7 9,028 0
NonlinearSolveFirstOrder QA 1.12.7 20 0
NonlinearSolveQuasiNewton Core 1.12.4 1,078 0
NonlinearSolveQuasiNewton QA 1.13.3 20 0

The remote PR already pointed to this child commit at the start of validation. The first QuasiNewton Core run printed all 1,078 passes before a shell-wrapper error. The complete repeat produced the same count and exited zero.

The FirstOrder commands use the test target produced by Pkg.test() for this checkout. Both Core targets resolve their solver packages to the checked-out source. Each invocation used a layered depot, four threads, four precompile tasks and a three-hour shell timeout.

export JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=4 JULIA_PKG_PRECOMPILE_AUTO=0 JULIA_PKG_OFFLINE=true OPENBLAS_NUM_THREADS=1
for group in Core QA; do
    GROUP="$group" JULIA_LOAD_PATH="@:$TARGET:@stdlib" timeout 10800 julia +1.12.7 --startup-file=no --compiled-modules=existing --check-bounds=yes --project="$TARGET" lib/NonlinearSolveFirstOrder/test/runtests.jl
done
# NonlinearSolveFirstOrder Core
# SciMLOperator Jacobians | 14 14 19.3s
# NonlinearSolveFirstOrder QA
# QA | 20 20 11m00.5s

GROUP=Core JULIA_LOAD_PATH="@:@stdlib" timeout 10800 julia +1.12.4 --startup-file=no --compiled-modules=existing --project=lib/NonlinearSolveQuasiNewton -e 'using Pkg; Pkg.test()'
# NonlinearSolveQuasiNewton Core
# Broyden: linsolve keyword | 12 12 8.8s
GROUP=QA JULIA_LOAD_PATH="@:@stdlib" timeout 10800 julia +1.13.3 --startup-file=no --compiled-modules=existing --project=lib/NonlinearSolveQuasiNewton -e 'using Pkg; Pkg.test()'
# NonlinearSolveQuasiNewton QA
# QA | 20 20 2m55.0s

The prior run on this head completed the root CPU Reactant suite on Julia 1.12.4, 1.12.7 and 1.13.3, root Core and QA, and Core and QA for SCCNonlinearSolve, SimpleNonlinearSolve and NonlinearSolveBase. Runic, typos and the whitespace check exited zero. GPU execution, downstream packages, documentation and benchmarks were outside this local validation. The workflow and repository-instruction changes flagged as H6 in the review still require the owner's decision.

The hosted Reactant check passed on this head. The sole failing check was documentation link checking. GitHub returned HTTP 502 for two links present on master, and both returned HTTP 200 on a fresh GET. The latest master push passed the documentation job. Reactant check · Documentation failure · Master documentation check

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 01a2151c-5288-7a41-a1f0-5083494c84a4 (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.171.0 gpt-6.1-terra (head c4a57fb)

The traced identity initialization now broadcasts over the whole matrix, including one-element matrices. The dense simple Broyden update conjugates the complex step in its right factor. Host and compiled tests cover both SimpleBroyden and the limited-memory dense fallback, checking the exact solution and both residuals.

Validation used Julia 1.12.4, four threads, a job-local depot, and a driver that imports the test dependencies and includes test/Reactant/simple_tests.jl. DRIVER denotes that driver. The same command was run with the added tests before and after the source fix:

timeout 3600 julia +1.12.4 --compiled-modules=existing --startup-file=no --project=test/Reactant "$DRIVER"
Before: Scalar indexing is disallowed.
Simple Broyden real and complex steps | 8 pass, 16 fail, 2 error, 26 total
After:
Simple Broyden real and complex steps | 32 pass, 32 total

GROUP=Core timeout 3600 julia +1.12.4 --project=lib/SimpleNonlinearSolve -e 'using Pkg; Pkg.test()'
First Order Methods  | 511 pass, 3 broken, 514 total
Second Order Methods | 62 pass, 1 broken, 63 total
Testing SimpleNonlinearSolve tests passed

GROUP=QA timeout 3600 julia +1.12.4 --project=lib/SimpleNonlinearSolve -e 'using Pkg; Pkg.test()'
QA | 20 pass, 20 total
Testing SimpleNonlinearSolve tests passed

julia +1.12.4 --compiled-modules=existing --project=@runic -m Runic --inplace lib/SimpleNonlinearSolve/src/broyden.jl lib/SimpleNonlinearSolve/src/utils.jl test/Reactant/simple_tests.jl
git diff --unified=0 | sed -n '/^+++ /d;s/^+//p' | typos -
git diff --check

The four broken Core assertions match the previously reported count. Runic, typos and diff check exited zero. Core resolved the local SimpleNonlinearSolve and NonlinearSolveBase sources. The current master contains an unrelated change to parent-owned solve.jl; it was not merged into this child fix. The full Reactant group and GPU paths were not rerun.

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.171.0 · model: gpt-6.1-terra
Conversation: local session 01a21797-41fc-78a0-8ded-20cecc276f8e (no session URL)

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Re-stacked on the rebased #1197 (after #1072); NonlinearSolveBase compat is now 2.50. Full Reactant matrix 147/147 and Simple Core 1.10/1.12 + QA pass locally on this stack.

🤖 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

@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the reactant-simple branch 3 times, most recently from 4601664 to 458b609 Compare August 30, 2026 11:31
ChrisRackauckas-Claude and others added 2 commits September 6, 2026 02:55
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
Write each simple solver iteration once as a `ReactantCore.@trace while` loop
without early returns, so the same code runs on the host and under
`Reactant.@compile`. Loop state is prepared by `Utils.init_loop_state`/
`Utils.fresh` and the solution by `Utils.simple_solution`; the Reactant-only
shadow solution, copies and duplicated loops are removed.

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 13 commits September 26, 2026 09:36
…Base layouts

`iteratively_build_sols(probs::AbstractVector)` spells out
`NonlinearSolution{...}` to type the `sols` buffer, and the vector-form
test spells the same type into the `FunctionWrapper` `SubArray` signature.
SciMLBase #1620 adds a trailing `RC` type parameter to `NonlinearSolution`,
which turns that application into a UnionAll: `Vector{ST}` then has an
abstract eltype and `isconcretetype(eltype(original))` fails.

`stripped_solution_type` spells the ten non-`RC` parameters and applies
`ReturnCode.T` only when the spelled result is not already concrete, so
`ST` is the concrete stripped-solution type under both the released
SciMLBase layout and the #1620 layout. Verified: GROUP=Core passes
against SciMLBase 3.56.0 and against the #1620 branch, including the
vector-form concreteness assertion.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Devin <[email protected]>
Agent-Harness: Devin CLI 3000.11.3
Agent-Model: swe-2-high
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/SciMLBase.jl/jobs/1619-devin/log.txt on amdci2.julia.csail.mit.edu
Vector-form SCC users wrap explicitfuns with a FunctionWrapper whose
second argument spells SubArray{SSol,...}. Prefer that declared SSol
over the concrete stripped_solution_type so legacy ten-parameter
signatures keep converting under SciMLBase #1620's trailing RC param.
Add a regression test for the old signature next to the updated one.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1332-cursor/log.txt on amdci2.julia.csail.mit.edu
sols_buffer_eltype previously only inspected eltype/first, so
Any[plain_noop, legacy_FW] still built a concrete buffer and broke
conversion. Scan every element after the eltype fast path. Derive
item4's SubArray element type from public strip_solution instead of
the internal stripped_solution_type helper, and cover the mixed
container in item8.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1332-cursor/log.txt on amdci2.julia.csail.mit.edu
Preserve master's solver defaults, bounded methods, and trust-region safeguards.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.157.1
Agent-Model: gpt-6-astra
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-codex/log.txt on amdci2.julia.csail.mit.edu
Retain the companion branch's concrete and legacy FunctionWrapper buffer handling.
Core validation: SCCNonlinearSolve tests passed on Julia 1.12.7.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.157.1
Agent-Model: gpt-6-astra
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-codex/log.txt on amdci2.julia.csail.mit.edu
Reactant compilation carries TracedRNumber{Bool} success flags through
MoreTrustRegionDescent; ConcreteStructs must not pin linsolve_success to Bool.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Residual-dependent Moré control flow becomes ifelse/select forms with a
ReactantCore.@trace λ-iteration, matching host iterates while compiling.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
More/Yuan/Fan radius policies use ifelse, and NLStats mutations gate on
within_compile so traced TrustRegion/LM steps stay on one path.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
nf/njacs/nsolve/nsteps updates are Int mutations that cannot be traced;
gate them so ordinary solve remains the compiled path.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Move unreleased dependency pins into test/Reactant [sources], assert
ConcreteEnum retcodes, and exercise small-radius TrustRegion compiles.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Pick up SciML#1324 AutoDespecialize adjoint unwrap fix so Adjoint CI matches master.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
Released Reactant v0.2.289 includes traced enums (#3232); drop the
EnzymeAD main source pins. Keep the SciMLBase #1620 source pin —
v3.56.1 predates that merge.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
`got_step | accept_gn` hit runtime dispatch when the @trace-carried
got_step widened to Integer in inference. Use ifelse so host Bool and
traced Bool stay on one concrete path.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.09.26-dd393fe
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/NonlinearSolve.jl/jobs/1197-cursor/log.txt on amdci2.julia.csail.mit.edu
ChrisRackauckas and others added 2 commits November 23, 2026 08:38
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)
Check the LU determinant sign before Halley's traced step and retain the
current point on failure. Restore Broyden's host exact-root return before
workspace setup. Carry the optional line-search decision explicitly, and
reject unsupported low-rank iterations during tracing.

Use the parent's registered DifferentiationInterface environment and
termination logic. Exercise both singular residual regimes, small nonzero
pivots, dense Broyden fallback, and the two low-rank implementations.

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__1213--20261123T145331Z-codex-gpt-6.2-astra
Agent-Session: local session 01a208e5-fb5a-7ea2-9d12-deb27c3fa37d (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: #1213

Reviewed head: f3ae789
Raw SHA-256: 9583bd1b3d65ade788dbc8da33da9602e5f1417e524d89fdf54c77ce926661db
Source SHA-256: f654c93cf7adb648964731fa02dddc0c2fc1034fc7f79fd4f349be467ec32003
Source: standard-review-v1 (harness-log)
Reviewer session: 01a21187-b1de-7730-916b-1b903b912249
Slot: 2
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

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

Review report

VERDICT: CHANGES
Round: 1
Head: f3ae789
Slot: 2
CI: CI is not green
Session: 01a21187-b1de-7730-916b-1b903b912249
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

high (H6: .github/workflows/benchmark.yml adds execution of PR-head Julia code in the LTS pull-request check through benchmark/test_sources.jl and the changed benchmark/ci.jl. AGENTS.md also changes pre-push validation and base-merge instructions.) An explicit owner decision is required before merging.

  • Blocking priorities: P1, P1, P1, P1, P1, P2, P2, P2, P2

Blocking findings

  1. [P1] An aliased polyalgorithm returns the wrong iterate with the winning residual. lib/NonlinearSolveBase/src/solve.jl:728. I used two members that honor alias_u0=true by writing their answer into prob.u0. For f(x)=x-1 starting at [2,2], the first member wrote the exact root. Compiled execution returned Success, u=[2,2], and resid=[0,0]. When both members reported MaxIters, it returned the second member's [3,3] with the first member's zero residual. The host returned [1,1] in both cases.

    Implementation fix: In _polysolve_compile_path and _polysolve_compile_member, give the retained winner its own iterate and residual buffers before reusing the trial buffer. Reset the trial guess only inside the branch that attempts the next member. Add both cases to test/Reactant/polyalgorithm_tests.jl and assert the winning iterate, caller's aliased buffer, retcode, and resid == f(u).

  2. [P1] Simple Newton can report success thousands of tolerances away from a root. lib/SimpleNonlinearSolve/src/raphson.jl:81. For f(x)=0.01f0*(x^2-1), an analytic Jacobian, x₀=0.01f0, and abstol=0.01f0, compiled execution returned Success at 50.004997 with reported residual -0.009999. Evaluating the function there gave 24.994997. The host produced the same result on both the merge base and the reviewed head. The new compiled path inherits the defect, so host agreement cannot validate it.

    Implementation fix: In the SciMLBase.__solve method for SimpleNewtonRaphson, check the initial residual against the initial iterate, then evaluate the residual at each updated iterate before passing the pair to check_termination. Only build another Jacobian when another iteration is needed. Cover the scaled example on the host and under Reactant, including the shared SimpleGaussNewton implementation. On success assert both residual consistency and the requested tolerance.

  3. [P1] Public compiled step! gives a different Newton step from solve! and advances an exhausted cache. lib/NonlinearSolveFirstOrder/src/solve.jl:508 and lib/NonlinearSolveBase/src/solve.jl:976. For u.^2 .- 2 starting at two ones, the analytic Jacobian was 2I and the descent returned [0.5,0.5] on both backends. A single compiled step!(init(...)) nevertheless produced u=[0,0], fu=[-2,-2]. Host stepping and a one-iteration compiled solve! both gave [1.5,1.5] and [0.25,0.25]. With maxiters=0, compiled stepping also advanced nsteps to one.

    Implementation fix: Share the unchecked single-iteration body between the full loop and public stepping. Have the compiled public wrapper execute it through a traced, at-most-one-iteration loop guarded by not_terminated(cache), carrying the accepted iterate, residual and counters through the branch. Add direct init; step! tests in test/Reactant/first_order_tests.jl for budgets zero and one with the exact states and counts above.

  4. [P1] Compiled solve! can turn an initialization failure into success. lib/NonlinearSolveBase/src/solve.jl:368. I initialized a Newton cache for f(u)=u.-1 at [2,2] and set its retcode to InitialFailure, the state assigned by _run_initialization!. Host solve! returned the original iterate and failure. Compiled solve! iterated to [1,1] and returned Success.

    Implementation fix: Carry initialization failure into the traced loop guard and preserve the failure result during finalization. Apply the same predicate to solve_cache!, the cache-only polyalgorithm path, and NonlinearSolveNoInitCache, where the failure shortcut is also gated on host execution. Test a failed initializer or a cache in its resulting state and assert InitialFailure, zero steps, and the original iterate and residual.

  5. [P1] The documented dense Newton path can deadlock the Reactant test process. lib/NonlinearSolveBase/src/linear_solve.jl:156. The Reactant group stopped making progress on Julia 1.12.4 and 1.13.3. A direct 1.12.4 run with two Julia compute threads passed the first three assertions and stalled in the tutorial test. Stack samples showed the XLA Julia host callback waiting in jl_gc_wait_for_the_world while the executable caller waited in BlockUntilReady. Two samples minutes apart on the first run showed the same waits. A standalone invocation of the tutorial-sized system did finish, so the hang depends on execution conditions.

    Implementation fix: Make the compiled matrix solve depend on a GC-safe execution path. Prefer fixing the executable wait in the owning backend and requiring the verified compatible version in the Reactant test environment. If that dependency fix is unavailable, use a backend-native public solve with verified default-solver semantics or reject the affected configuration before entering the callback. Update the GPU tutorial to match the supported combination. Run the tutorial in a fresh process under allocation pressure and require it to return sqrt(2) with Success, then run the full Reactant group.

  6. [P2] Compiled polyalgorithms discard successful endpoint results. lib/NonlinearSolveBase/src/solve.jl:655. With f(x)=x*(x-1), the first member returned the root zero with ExactSolutionLeft, and the second returned one with Success. The host stopped at zero. The compiled solve selected one. I also checked that SciMLBase classifies both endpoint codes as successful and _poly_success rejects both.

    Implementation fix: Share the member-acceptance predicate with the host, using SciMLBase's successful codes and the intentional StalledSuccess exception. If the predicate needs lowering for traced enums, derive its accepted constants from the public predicate. Add two-member tests for both endpoints and retain a test that escalates StalledSuccess.

  7. [P2] SimpleBroyden divides by zero after accepting a rational iterate. lib/SimpleNonlinearSolve/src/broyden.jl:99. With rational initial state [1,1], constant residual [0,1//100], alpha=1//1, and abstol=reltol=0.1, the merge base returned Success at [1,99//100]. The head threw DivideError. The residual difference is zero and the inverse-Jacobian update runs after the termination check.

    Implementation fix: Guard the rank-one update and next-iteration buffer writes with !solved. Keep a host early return or use a traced conditional for the compiled branch. Add this nonzero-residual case to the SimpleNonlinearSolve core tests and assert the exact iterate, residual and return code.

  8. [P2] The public de-aliasing helper misses nested arrays and writes through constant fields. lib/NonlinearSolveBase/src/reactant.jl:42 and :62. Under compilation I de-aliased [u,u] and incremented only the first result. The second changed from [-0.0,1.0] to [1.0,2.0]. In a Newton solve with a mutable parameter struct containing a const target array, the host converged and compilation threw setfield!: const field .target of type Param cannot be changed.

    Implementation fix: Traverse assigned elements of Julia container arrays before the scalar-element shortcut, retaining cycle protection. Rebuild objects whose changed fields are constant and propagate the replacement to the parent, or keep read-only parameters outside mutable loop state. Extend test/Reactant/reactant_tests.jl to assert independence after mutation and convergence with the constant-field parameter.

  9. [P2] Decorating a supported SCC callback breaks its solution-view type. lib/SCCNonlinearSolve/src/SCCNonlinearSolve.jl:155. I ran the concrete-signature fixture from core_tests__item4.jl, then changed only the callbacks to map(f -> (p, sols) -> f(p, sols), explicitfuns). Direct callbacks passed. The decorated solve threw MethodError: Cannot convert between solution views with an unspecified and a concrete retcode parameter. The added adapter test covers only the unspecified signature.

    Implementation fix: Carry the required history element type at the callback boundary. One design is an SCC-owned history adapter with a conversion that supplies a correctly typed view of completed solutions when a FunctionWrapper requests it. Preserve the direct typed-view fast path. Exercise decorated callbacks with both signatures and a mixed vector in the SCC core suite. Assert that all solve the same coupled system.

Non-blocking findings

  • AGENTS.md:12 says root tests resolve released sublibraries. The Julia 1.12.4 root test manifest resolved lib/NonlinearSolveBase and lib/NonlinearSolveQuasiNewton from the checkout. Implementation fix: Replace that rationale with “Run Core and QA from each changed sublibrary so its own test groups execute. Check the resolved source paths when validating local sublibrary changes.” This is a text-only correction.
  • lib/SCCNonlinearSolve/test/core_tests__item8.jl:12 repeats the coupled residuals, wrapper setup and reference system from core_tests__item4.jl. Implementation fix: Share the two-block fixture and run the signature and decoration cases against it. Keep the reference-root comparison and the signature-specific element-type assertions in the SCC Core group.

What I ran

  • Reviewed git diff origin/master...HEAD and the rename-aware path list. All 76 paths were additions or modifications. git diff --check origin/master...HEAD and typos over the changed files produced no diagnostics.
  • Used scratch copies with the supplied layered Julia depot. On Julia 1.12.4, GROUP=Core julia --project -e 'using Pkg; Pkg.test()' ended with NonlinearSolve tests passed. The corresponding --project=lib/<package> Core and QA runs passed for NonlinearSolveBase, NonlinearSolveFirstOrder, NonlinearSolveQuasiNewton, NonlinearSolveSpectralMethods, SimpleNonlinearSolve, SCCNonlinearSolve, SciMLJacobianOperators and NonlinearSolveHomotopyContinuation. The warmed active-step test passed 5/5.
  • Ran GROUP=Reactant julia --project -e 'using Pkg; Pkg.test()' on Julia 1.12.4 and 1.13.3, plus the direct test entry on 1.12.4 with --threads=2,1. I stopped all three after sampling the blocked processes. The probe environment resolved Reactant 0.2.309, LinearSolve 5.19.0 and SciMLBase 3.58.0.
  • Ran the numerical, cache, aliasing, termination and SCC probes described above. Reran the host SimpleNewtonRaphson and rational SimpleBroyden examples on the merge base with the same resolved dependency versions.
  • Ran benchmark/test_sources.jl with Julia 1.10.12 and AirspeedVelocity 0.6.5. Checkout source resolution passed 3/3.
  • uv run --locked python --version printed Python 3.13.13 and warned that --locked has no effect outside a project. The checkout contains no Python project or lockfile.

What I did not verify

The full Reactant matrix did not complete. I did not verify GPU execution, downstream packages, the rendered documentation, full two-revision benchmarks, or hosted CI.

AUTHOR_GRADE: {"task":"feature","score":2,"difficulty":5,"rounds":1,"author_harness":"Codex CLI 0.170.0","author_model":"gpt-6.2-astra","note":"Host Core and QA coverage is substantial. Independent probes found inconsistent successful solutions, discarded cache state, a host regression and a reproducible callback deadlock."}

Head link: f3ae789


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a21187-b1de-7730-916b-1b903b912249 (no session URL)

ChrisRackauckas and others added 4 commits November 25, 2026 05:16
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)
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__1213--20261125T104331Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2124d-cd0c-7873-8e13-aee5a138e440 (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__1213--20261125T104331Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2124d-cd0c-7873-8e13-aee5a138e440 (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: #1213

Reviewed head: f9bd73d
Raw SHA-256: 9b73500b613d394439bf01ea0ef6d0f0c3e634de95ae9f8c2397df8f5079bb60
Source SHA-256: a6450876fe016dcc5a19f6812111583be1a938f50bb83d3d843e23410458f828
Source: standard-review-v1 (harness-log)
Reviewer session: 01a212ce-9d50-7900-90fd-8ebb87623bfc
Slot: 2
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

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

Review report

VERDICT: CHANGES
Round: 2
Head: f9bd73d
Slot: 2
CI: CI is not green
Session: 01a212ce-9d50-7900-90fd-8ebb87623bfc
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

high (H6: .github/workflows/benchmark.yml adds execution of PR-head Julia code on the LTS benchmark runner through benchmark/test_sources.jl and benchmark/ci.jl. AGENTS.md also changes the instructions governing pre-push validation and base merges.) Merging requires an explicit owner decision.

  • Blocking priorities: P1, P1, P2, P2

Blocking findings

  1. [P1] The compiled default dense solver discards a required Newton direction. lib/NonlinearSolveBase/src/utils.jl:338, called from lib/NonlinearSolveBase/src/linear_solve.jl:142. I solved A*u = [1,1] from zero with a dense Float32 Jacobian A = diag(1, 2^-27). Both the matrix and the exact solution are representable. On Julia 1.12.4 and 1.13.3, host Newton returned Success at [1, 134217728] with zero residual. Compiled Newton returned MaxIters at [0,0] with residual [-1,-1] after a budget of three steps. In isolation the compiled SVD solve returned [1,0], leaving the entire second equation unsatisfied. A compiled pivoted LU solve returned the exact answer on the same input.

    Implementation fix: In ReactantLinearSolveCache, use a device-side pivoted solve for full-rank square systems and propagate factorization status. Keep a distinct rank-deficient or rectangular policy for callers that need a least-squares solution. Review linsolve_identity!!, the other caller of traced_matrix_solve, separately because it requests a pseudoinverse fallback. Add the powers-of-two system to test/Reactant/linear_tests.jl and assert the Newton step, successful retcode and both components of the recomputed residual. Retain singular-system and host-callback checks and update the GPU tutorial's description of the dense solver.

  2. [P1] The Reactant group still errors on Julia 1.12.4. lib/NonlinearSolveBase/src/descent/more_trust_region.jl:1385. The tutorial now passed all four checks. The group then stopped at test/Reactant/reactant_tests.jl:140 compiling TrustRegion(), with 17 passes and one error, Missing Julia object for global. A probe importing only Reactant reproduced the error with @views @. q[(m+1):end] = d / sqrt(lambda). Computing the scalar square root before the broadcast returned the expected Float32[0,0,1,2]. Focused runs found the same compiler diagnostic in the diagonal Broyden update and the new scalar Simple Newton regression. The full Reactant test entry exited zero on Julia 1.13.3 with the same Reactant and GPUCompiler versions.

    Implementation fix: In _more_augmented_qrhs!, compute root = sqrt(λ) before broadcasting Dp / root. In the Broyden update at lib/NonlinearSolveQuasiNewton/src/broyden.jl:164, likewise compute the scalar guarded denominator before the vector broadcast. In lib/SimpleNonlinearSolve/src/raphson.jl:84, use ordinary subtraction for scalar iterates and retain the in-place update for arrays. I verified the first rewrite in isolation. Run the existing compiled trust-region, diagonal cubic Broyden and scalar Newton cases on both Julia versions. Add the reduced augmented-RHS case with its exact four-element result to the Reactant tests and cover Julia 1.12 in the group matrix.

  3. [P2] Compiled Simple Newton evaluates the Jacobian after the solve is already finished. lib/SimpleNonlinearSolve/src/raphson.jl:66. I used f(x) = x.^2 .- 1 and an analytic Jacobian that increments a device counter. At x₀ = [1.001f0] with abstol = 0.01f0, both executions immediately returned success. With x₀ = [2f0] and maxiters = 0, both returned the initial point with MaxIters. The host counter remained zero in both cases and the compiled counter was one in both, on Julia 1.12.4 and 1.13.3. The accepted-point callback-count test currently exercises the host only.

    Implementation fix: In the shared SimpleNewtonRaphson and SimpleGaussNewton implementation, put the first Jacobian evaluation inside the active-step guard. Prepare loop storage without invoking the user's derivative, then evaluate the Jacobian once per attempted step. Extend test/Reactant/simple_tests.jl with the counter for initially acceptable residuals, exhausted budgets and an active one-step control. Assert counts of zero, zero and one, respectively, together with the returned point and residual.

  4. [P2] Decorating an ordinary SCC transfer callback breaks dispatch that worked on the preceding head. lib/SCCNonlinearSolve/src/SCCNonlinearSolve.jl:181. I solved two scalar blocks where the second target comes from the first solution. Both transfer(p, history::SubArray) and (p, history) -> transfer(p, history) returned Success [2.0, 2.0] on the preceding head. Here the direct form still succeeds, while the decorated form throws MethodError: no method matching transfer(::Vector{Float64}, ::SCCNonlinearSolve.SCCHistory{…}). The untyped outer function passes the applicable test. Julia dispatch on the inner function does not invoke the adapter's conversion.

    Implementation fix: Preserve a SubArray at the ordinary callback boundary in callback_history. One design is to pass a view over an SCC-owned backing vector and specialize the FunctionWrapper conversion on views with that backing type. Keep passing the original view when a callback explicitly accepts its exact type. In lib/SCCNonlinearSolve/test/core_tests__item4.jl, add the decorated ordinary ::SubArray callback alongside the concrete and partial FunctionWrappers. Assert that direct and decorated callbacks transfer the same first-block value and return the same coupled solution.

Non-blocking findings

None.

What I ran

  • Checked the full rename-aware diff against origin/master (63 modified paths, 14 added). The supplied round-two delta matched the Git diff from the preceding head byte for byte. git diff --check origin/master...HEAD and typos over the changed paths produced no diagnostics.
  • On Julia 1.12.4, GROUP=Core julia --project=. -e 'using Pkg; Pkg.test()' passed. Core and QA passed with --project=lib/<package> for NonlinearSolveBase, NonlinearSolveFirstOrder, SimpleNonlinearSolve and SCCNonlinearSolve. Each QA run reported 20/20. I used scratch copies, checked the resolved local package paths and preserved the supplied layered depot.
  • Ran GROUP=Reactant julia --project=. -e 'using Pkg; Pkg.test()' on 1.12.4 and the full test/Reactant/reactant_tests.jl entry under its own project on 1.13.3. Both resolved Reactant 0.2.309 and GPUCompiler 2.10.0. A fresh 1.12.4 process also passed the dense Newton tutorial 4/4.
  • Focused 1.12.4 runs passed the public stepping checks 12/12, failed-initialization checks 30/30, polyalgorithm checks 68/68 and combined-norm checks 4/4. I reran the Simple test file with its parent fixtures loaded after an initial standalone invocation omitted two helpers. That run had 28 passes and one scalar Newton compilation error. Targeted numerical, Jacobian-count and callback-dispatch probes produced the results above.
  • uv run --locked python --version printed Python 3.13.13. uv reported that --locked has no effect outside a project. The checkout has no Python project or lockfile.

What I did not verify

GPU hardware, downstream packages, rendered documentation, benchmark timings and hosted CI. The 1.12.4 Reactant group stopped at the trust-region compile error, so its focused reruns cover only part of that matrix.

AUTHOR_GRADE: {"task":"feature","score":3,"difficulty":5,"rounds":2,"author_harness":"Codex CLI 0.170.0","author_model":"gpt-6.2-astra","note":"Core and QA pass, the prior stepping and aliasing regressions have effective tests, and the full Reactant entry passes on Julia 1.13.3. Independent probes still expose loss of a full-rank Newton direction, unnecessary derivative calls, an SCC callback regression and Julia 1.12 compilation errors."}

Head link: f9bd73d


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a212ce-9d50-7900-90fd-8ebb87623bfc (no session URL)

ChrisRackauckas and others added 2 commits November 25, 2026 09:48
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__1213--20261125T144730Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2132d-4923-7203-9309-18780dfb9f88 (no session URL)
Evaluate Simple Newton Jacobians only for attempted steps and keep scalar
arithmetic outside broadcasts in the Newton and Broyden updates.
Pass history views to ordinary SCC callbacks while retaining conversion
to the element types declared by wrapped transfers. Exercise the dense
Newton path on the exact three-step Float32 system.

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__1213--20261125T144730Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2132d-4923-7203-9309-18780dfb9f88 (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: #1213

Reviewed head: 60e7b46
Raw SHA-256: bd9896cfb57d5046218a0209780fed32d254e8988250897627716d901f30b408
Source SHA-256: fab1a08f2faf9ba2b876270564efc754f268848a5c1d25fd3ebaf0edd919a2d2
Source: standard-review-v1 (harness-log)
Reviewer session: 01a2139c-8c08-7ef1-bd33-03f2d36fa221
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: 60e7b46

Review report

VERDICT: CHANGES
Round: 3
Head: 60e7b46
Slot: 1
CI: CI is not green
Session: 01a2139c-8c08-7ef1-bd33-03f2d36fa221
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

high (H6: .github/workflows/benchmark.yml adds an LTS runner step executing PR-head benchmark/test_sources.jl, which includes the modified benchmark/ci.jl executor. AGENTS.md also changes instructions governing pre-push validation and base merges.) An explicit owner decision is required.

  • Blocking priorities: P1, P1, P1, P2, P2

Blocking findings

  1. [P1] Compiled polyalgorithm initialization can report success after the auxiliary solve misses the caller’s tolerance. At lib/NonlinearSolveBase/src/polyalg.jl:320, initialization runs on the problem before the child caches exist, so it reads problem-level tolerances and loses the keywords passed to init. I used two Newton members, the auxiliary equation x² = p starting at one with one Newton step, and the outer equation u = 4. On Julia 1.13.3, with p = 1 + 2^-9 and abstol = reltol = 1f-8, the auxiliary residual is exactly 2^-20 in each component. Host solve!(init(...)) returned InitialFailure at the mapped iterate. Compiled execution returned Success at four. The discrepancy also goes the other way. For p = 1.5f0 and abstol = 0.1f0, the auxiliary residual is exactly 0.0625. The host cache reached four with zero residual, while the compiled cache stopped at 1.25 with outer residual -2.75. Both one-shot paths followed the problem defaults in these probes.

    Implementation fix: Pass the effective call-site abstol and reltol through run_initialization! to get_initial_values in initialization.jl. Resolve omitted values using the existing problem defaults and preserve explicit OverrideInit overrides. Use the same resolution in polyalgorithm __init, _polysolve_compile_path, and the generated one-shot driver in solve.jl. Add these two one-step cases to test/Reactant/first_order_tests.jl and assert the mapped failure state, successful outer root, recomputed outer residual and retcode across host/compiled and cached/one-shot calls.

  2. [P1] Simple Newton and Simple Gauss–Newton fail to compile with an analytic Jacobian. At lib/SimpleNonlinearSolve/src/raphson.jl:84, the traced loop captures an outer J = nothing and returns a Jacobian in that same slot. Both Julia 1.12.4 and 1.13.3 reported Types do not match between function arguments and results, naming J. In an independent one-step probe of x² - 1 from [2f0], both host solvers called the Jacobian once and returned [1.25] with residual [0.5625]. Both compiled calls errored before producing a step. The 1.12.4 group also hit this mismatch with a scalar Jacobian and in the new callback-count test.

    Implementation fix: In the shared SciMLBase.__solve in raphson.jl, compute the compiled Jacobian and direction inside a step-local helper that returns only the direction. Keep the reusable J binding and its assignment on the host branch. Keep derivative evaluation inside the active step. The existing analytic-Jacobian and callback-count tests already discriminate. Extend the counter case to reuse one compiled executable for acceptable and active initial states, asserting zero and one callbacks respectively, the exact active iterate and its residual. Retain the zero-budget check and run both solver variants on both Julia versions.

  3. [P1] Scalar Newton still fails on Julia 1.12.4 in the stall check. The Reactant group’s scalar autodiff case errored at lib/NonlinearSolveBase/src/termination_conditions.jl:130 with Missing Julia object for global. The stack enters a zero-dimensional broadcast for u .- u. In a fresh process importing only Reactant, compiling (x,y) -> x .- y reproduced the diagnostic for two Float32 device scalars. Compiling (x,y) -> x - y on the same inputs returned exactly 1f0. The scalar autodiff test passed 9/9 on Julia 1.13.3.

    Implementation fix: Give scalar iterates an ordinary subtraction path in alloc_u_diff_cache and in the corresponding step difference in _check_safe_termination_traced! at line 383. Preserve array broadcasting and in-place storage for arrays. In test/Reactant/termination_tests.jl, exercise scalar stall tracking through initialization and an active step and assert the recorded step norm. Keep the scalar Newton/default end-to-end check and add Julia 1.12.4 to the Reactant matrix in test/test_groups.toml so the failing compiler version runs it.

  4. [P2] Decorating a strided SCC transfer still changes dispatch. At lib/SCCNonlinearSolve/src/SCCNonlinearSolve.jl:185, the history is now a view, but its SCCHistory parent makes it ineligible for StridedVector. I solved two coupled scalar blocks with transfer(p, history::StridedVector), both directly and through (p,h) -> transfer(p,h). On origin/master both returned Success [2.0, 2.0]. On this head the direct form gave the same result and the decorated form threw a MethodError in the transfer. The applicability check sees only the untyped decorator.

    Implementation fix: Make the SCC-owned backing type expose the dense, contiguous storage it actually wraps. In SCCNonlinearSolve.jl, implement SCCHistory as a DenseVector with strides and pointer conversion forwarded to its backing vector, preserving the specialized view conversion used by FunctionWrappers. Extend the ordinary callback test in lib/SCCNonlinearSolve/test/core_tests__item4.jl with the strided signature, direct and decorated. Assert the unit stride, transferred first-block value, coupled result and successful retcode. Retain the concrete and partial FunctionWrapper cases.

  5. [P2] The public tolerance accessor cannot read the initialized polyalgorithm cache under compilation. At lib/NonlinearSolveBase/src/polyalg.jl:157, get_abstol indexes a Julia tuple with the newly traced cache.current. Immediately after init on the auxiliary problem, the host accessor returned 0.1f0. On both Julia versions the compiled accessor threw a getindex(::Tuple, …) method error at that line. Inspection shows the identical indexing operation in get_reltol at line 160.

    Implementation fix: Route get_abstol and get_reltol through _poly_current_value, as the adjacent state and residual accessors already do. In test/Reactant/first_order_tests.jl, read both tolerances from an auxiliary-initialized cache before and after a successful solve. Supply distinct values and assert the same pair on the host and device.

Non-blocking findings

None.

What I ran

  • Verified the supplied delta against git diff f9bd73dc29fb6ba14459ffe078b574d26f7a507a..HEAD byte for byte. The full rename-aware diff against origin/master had 65 modified and 14 added paths. git diff --check origin/master...HEAD and typos over the changed paths produced no diagnostics.
  • On Julia 1.12.4, GROUP=Core julia --project=. -e 'using Pkg; Pkg.test()' passed. The Core and QA groups passed with --project=lib/<package> for NonlinearSolveBase, NonlinearSolveQuasiNewton, SCCNonlinearSolve and SimpleNonlinearSolve. Each QA group passed 20/20. Runs used scratch copies of the checked-out sources and the supplied layered depot.
  • GROUP=Reactant julia --project=. -e 'using Pkg; Pkg.test()' on Julia 1.12.4 reported 515 passes and 5 errors. Four errors named the loop-carried Jacobian and one was the scalar broadcast error. On Julia 1.13.3, running test/Reactant/reactant_tests.jl under --project=test/Reactant stopped at the analytic Simple Newton compile error. Both environments resolved Reactant 0.2.309 and GPUCompiler 2.10.0.
  • Focused reruns of linear_tests.jl, first_order_tests.jl and diagonal_tests.jl passed 160/160 on each Julia version. The small-pivot regression also passed an independent row-pivoting case with solution [2^27, 5] and zero residual. A singular control returned [0, 3] with zero residual. The full 1.12.4 group passed the diagonal cubic Broyden check 3/3.
  • Ran the tolerance, callback-count, scalar-subtraction and SCC probes described above. The SCC comparison used separate copies of this head and origin/master. The tolerance probe was rerun comparing retcodes directly after its initial printer tried to reconstruct an already-native enum.
  • uv run --locked python --version printed Python 3.13.13. uv reported that --locked has no effect outside a project. The checkout contains no Python project or lockfile.

What I did not verify

GPU hardware, downstream packages, rendered documentation, benchmark timings and hosted CI. The Julia 1.13.3 full-file run stopped at its first failing testset. The focused reruns cover the three files named above.

AUTHOR_GRADE: {"task":"feature","score":2,"difficulty":5,"rounds":3,"author_harness":"Codex CLI 0.170.0","author_model":"gpt-6.2-astra","note":"The pivoted dense solve and 160 focused assertions pass on both Julia versions. Compiled initialization can reverse the caller’s acceptance decision, both Simple Newton variants fail to compile, and scalar termination and SCC callback regressions remain reproducible."}

Head link: 60e7b46


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a2139c-8c08-7ef1-bd33-03f2d36fa221 (no session URL)

ChrisRackauckas and others added 4 commits November 25, 2026 14:45
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)
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__1213--20261125T194712Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2143f-a85a-7233-8130-e1049c3741ff (no session URL)
…ansfers

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__1213--20261125T194712Z-codex-gpt-6.2-astra
Agent-Session: local session 01a2143f-a85a-7233-8130-e1049c3741ff (no session URL)
…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)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

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

PR: #1213

Reviewed head: 9f697a4
Raw SHA-256: 30b3373b6ad44bf625f2a0f90d9b2966d400ace08dccd233b5263b04daf944c4
Source SHA-256: 31098326b0b71e80e4ade1d68031b2891d4285833172daa7d9d816740cb227ed
Source: standard-review-v1 (harness-log)
Reviewer session: 01a2159b-dae6-7102-b9e3-bf306708f1f1
Slot: 2
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: high (H6)
  • Verdict: CHANGES
  • Reviewed head: 9f697a4

Review report

VERDICT: CHANGES
Round: 4
Head: 9f697a4
Slot: 2
CI: green
Session: 01a2159b-dae6-7102-b9e3-bf306708f1f1
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

high (H6: .github/workflows/benchmark.yml adds an LTS runner step that executes PR-head benchmark/test_sources.jl, which includes the modified benchmark/ci.jl executor. AGENTS.md changes instructions governing pre-push validation and base merges.) An explicit owner decision is required.

  • Blocking priorities: P1, P1

Blocking findings

  1. [P1] The new diagonal Broyden test requires a numerically wrong update. At test/Reactant/diagonal_tests.jl:59, the expected value repeats the extra factor of du in the implementation. In one dimension, a nonsingular inverse secant update must give H_new * y == s. With H = 1, residual change y = 1 and step s = 2, I measured H_new = 1 for diagonal storage and 2 for dense storage, on both the host and Reactant. This affects an ordinary solve. For f(x) = x/2 - 2 from zero, with alpha=1 and two steps, dense good Broyden reached four with zero residual. Diagonal Broyden stopped at three with residual -0.5 on both backends. The formula predates this delta. The new assertion would reject its correction.

    Implementation fix: In the diagonal InternalAPI.solve! at lib/NonlinearSolveQuasiNewton/src/broyden.jl:163, store Hy = diag(H) .* y in the existing scratch vector. Compute the denominator separately as dot(s, Hy), retain the zero-denominator safeguard, and update the diagonal with (s .- Hy) .* s .* diag(H) ./ denom. In diagonal_tests.jl, compare the good-Broyden results to the independent rank-one update H + (s - H*y) * (s' * H) / denom or its diagonal. The existing two-component regular fixture must produce diagonal [2, 9]. For bad Broyden, use the rank-one correction with right factor y' and denominator dot(y,y), applying the safeguard at zero. For both dense cases, assert the returned matrix so the rank-one addition is also exercised. Add the one-dimensional secant and two-step solve above on host and compiled paths, asserting the exact inverse, root, residual and successful retcode.

  2. [P1] One-shot polyalgorithm initialization fails to compile when the caller supplies device tolerances. At lib/NonlinearSolveBase/src/solve.jl:766, a data-dependent initializer encloses the member solve in a traced branch. The new test at test/Reactant/first_order_tests.jl:225 passes ordinary Julia tolerance values. I supplied distinct Reactant.ConcreteRNumber{Float32} inputs to two Newton members, with the one-step auxiliary equation x² = 1.5 from one and outer equation x = 4. At abstol=0.1f0, the host returned four with zero residual. Compilation of the one-shot call failed with operand #5 does not dominate this use, identifying a function-return operand defined inside a child region. The probe returned only the iterate, residual and retcode. The same device tolerances worked for a one-shot polyalgorithm without auxiliary initialization. One compiled cached executable also distinguished abstol=1f-5 (mapped iterate 1.25, residual -2.75, InitialFailure) from 0.1f0 (four, zero, Success).

    Implementation fix: In _polysolve_compile_path in lib/NonlinearSolveBase/src/solve.jl, give each supplied traced tolerance a fresh scalar binding before forwarding it to _initialize_polyproblem and the member solve. Use the existing dealias_traced! helper on the supplied tolerance values and preserve omitted keywords and explicit initializer overrides. Freshening each tolerance as t + zero(t) at the public call site made the otherwise identical one-shot probe compile and return four with zero residual. In test/Reactant/first_order_tests.jl, compile the one-shot call once with two distinct device tolerance arguments. Run that executable with the strict and loose absolute tolerances above while holding the relative tolerance fixed, and assert the exact iterate, recomputed residual and retcode in each case.

Non-blocking findings

  • The scalar regression has no Julia 1.12.4 CI entry. test/test_groups.toml:62 selects only the moving "1" channel for Reactant. The full suite passed locally on 1.12.4, the version on which the prior review reproduced the scalar stall error. Implementation fix: Set versions = ["1.12.4", "1"] in the [Reactant] group. The existing test/Reactant/termination_tests.jl case already asserts one recorded step of exactly 0.75f0 and requires no source or documentation changes.

What I ran

  • Confirmed the supplied delta matched git diff 60e7b46ac2b1052b4ebc09f463470c06557e29bf..HEAD byte for byte. Inspected the rename-aware whole-PR path list and diff for context. The delta modifies 18 paths. The whole diff has 79 changed paths and no renames. git diff --check origin/master...HEAD and typos on all changed paths exited zero. The checkout remained clean.
  • On Julia 1.12.4, GROUP=Reactant julia --project=. -e 'using Pkg; Pkg.test()' reported 753/753 passed. On Julia 1.13.3, julia --project=test/Reactant -e 'using Pkg; Pkg.instantiate(); include("test/Reactant/reactant_tests.jl")' exited zero. Its summaries included 52/52 analytic Jacobian callback assertions, 68/68 initialization tolerance assertions, 8/8 tolerance accessor assertions and 4/4 scalar stall assertions. Both runs used scratch copies of this head, local solver source paths, the supplied layered depot, Reactant 0.2.309 and GPUCompiler 2.10.0.
  • On Julia 1.12.4, GROUP=Core julia --project=lib/<package> -e 'using Pkg; Pkg.test()' passed for NonlinearSolveBase, NonlinearSolveFirstOrder, SCCNonlinearSolve and SimpleNonlinearSolve. The vector-form SCC callback test passed 156/156. SimpleNonlinearSolve reported four broken assertions across its first- and second-order method tests. The diff adds no skips or broken markers.
  • Ran the independent secant, end-to-end Broyden, device-tolerance and fresh-tolerance probes reported above on Julia 1.13.3. The tolerance result was reproduced with separate device objects for the two inputs. A separate cache-reuse probe changed both the seed and problem parameter, exhausted the retained member, and wrapped to the first member. Both alias settings produced x = 2.6666667f0 and MaxIters on host and compiled paths.
  • uv run --locked python --version printed Python 3.13.13. uv reported that --locked has no effect outside a project. The checkout contains neither a Python project nor a uv lockfile.

What I did not verify

GPU hardware, downstream consumers, QA groups, rendered documentation, benchmark timings and hosted CI. The CI header records the supplied status. The independent device-tolerance and Broyden probes ran on Julia 1.13.3.

AUTHOR_GRADE: {"task":"feature","score":3,"difficulty":5,"rounds":4,"author_harness":"Codex CLI 0.170.0","author_model":"gpt-6.2-astra","note":"Both Reactant suites and four sublibrary Core groups passed. Independent probes exposed a new test that enforces an incorrect inverse secant and a one-shot compilation failure with device tolerances."}

Head link: 9f697a4


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a2159b-dae6-7102-b9e3-bf306708f1f1 (no session URL)

ChrisRackauckas and others added 4 commits November 26, 2026 00:16
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)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.171.0
Agent-Model: gpt-6.1-terra
Agent-Job: SciML__NonlinearSolve.jl__1213--20261126T072211Z-codex-gpt-6.1-terra
Agent-Session: local session 01a216bb-dcdb-79d1-9195-114ac1ca659f (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)
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.171.0
Agent-Model: gpt-6.1-terra
Agent-Job: SciML__NonlinearSolve.jl__1213--20261126T093456Z-codex-gpt-6.1-terra
Agent-Session: local session 01a21735-6a56-7bb3-8892-d77d27f1e7d4 (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: #1213

Reviewed head: d52d7b8
Raw SHA-256: ff9d5729cf2f23ba379d956b53a4d4dd11bd59af989294f8d119277146002f8f
Source SHA-256: 49d6a9b7cd0bd1436a1cbea5c706a95a02c9ee7de09e2822322131ccfabf83f1
Source: standard-review-v1 (harness-log)
Reviewer session: 01a21748-83e1-7f41-9cb5-9aa816726d73
Slot: 2
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

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

Review report

VERDICT: CHANGES
Round: 5
Head: d52d7b8
Slot: 2
CI: CI is not green
Session: 01a21748-83e1-7f41-9cb5-9aa816726d73
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

high (H6: .github/workflows/benchmark.yml executes PR-head benchmark/test_sources.jl on the LTS runner, which loads the changed benchmark/ci.jl executor. AGENTS.md changes the instructions governing pre-push validation and base merges.) An explicit owner decision is required.

  • Blocking priorities: P1, P2

Blocking findings

  1. [P1] Compiled SimpleBroyden rejects a one-element real vector. At lib/SimpleNonlinearSolve/src/utils.jl:38, J[diagind(J)] .= α lowers to a scalar write for a 1×1 traced matrix. I ran f(x,p) = x ./ 2 .- p from Float32[0] with p = Float32[2], alpha=1f0 and maxiters=2. The host returned [4], zero residual and Success. Reactant.@jit raised Scalar indexing is disallowed in identity_jacobian before the first step. Appending a zero component made the compiled solve succeed. The merge fixes this same identity-construction problem in the base package, but the simple solver constructs its own matrix.

    Implementation fix: In the array method of SimpleNonlinearSolve.Utils.identity_jacobian, fill the entire matrix under ReactantCore.within_compile() using the axis-equality broadcast already used in lib/NonlinearSolveBase/src/utils.jl (J .= ifelse.(axes(J, 1) .== axes(J, 2)', α, zero(α))). Return that matrix. In test/Reactant/simple_tests.jl, run the one-element real fixture above on host and under @jit, asserting the exact root, zero recomputed and reported residuals, and Success. Exercise SimpleLimitedMemoryBroyden(; alpha=1f0) too, since its small-vector path delegates to the same solver.

  2. [P2] The child’s simple Broyden update still uses an unconjugated complex step. At lib/SimpleNonlinearSolve/src/broyden.jl:102, the denominator uses the Hermitian dot, but the numerator uses the ordinary transpose of the step. I ran the same two-step equation with p = ComplexF32[2im, 0] and a zero vector. Both host and compiled SimpleBroyden returned [2im, 0], residual [-im, 0] and MaxIters. The dense fallback of SimpleLimitedMemoryBroyden reproduced all three results. The real control reached [4, 0] on both paths. For the complex case the first step is 2im and the residual change is im, so the inverse secant must map im to 2im. The exact second iterate is [4im, 0].

    Implementation fix: In the SimpleBroyden method of SciMLBase.__solve, compute the right-factor scratch column as transpose(J⁻¹) × vec(conj(δx)), as in the merged dense good-Broyden update. Its later transpose then gives δx' * J⁻¹. Add the two-component complex fixture to test/Reactant/simple_tests.jl for both algorithms on host and under @jit. Assert [4im, 0], recompute the residual at the returned iterate, and require both a zero reported residual and Success. The two-component fixture exercises the update independently of the singleton initialization failure.

Non-blocking findings

None.

What I ran

  • Compared the supplied delta byte-for-byte with git diff 9f697a4..HEAD. Inspected the rename-aware path lists for the 79-file stacked diff and the 24-file child diff. The parent’s Broyden and tolerance implementations and both regression files matched the merged head byte-for-byte. git diff --check and typos passed. The checkout stayed clean.
  • Ran the complete Reactant group body from scratch snapshots with julia --project=test/Reactant, Pkg.instantiate() and include("test/Reactant/reactant_tests.jl"). Both Julia 1.12.4 and 1.13.3 exited zero with Reactant 0.2.309 and GPUCompiler 2.10.0. On 1.12.4 the diagonal suites passed 20/20, 24/24 and 32/32, including the complex two-step regression. The one-shot device-tolerance test passed 6/6. The 1.13.3 enclosing testset reported 785/785.
  • Ran an independent Julia 1.12.4 probe against the previous head and this head with the same resolved dependencies. Dense and diagonal good Broyden reached the exact root 5+9im from 1+im on host and under @jit. One-shot and cached executables each distinguished loose, strict and loose device tolerances in sequence, returning (-3, 0, Success), (1.625, 4.625, InitialFailure) and (-3, 0, Success) as iterate, residual and code. All 36 assertions passed here. On the previous head the host complex solves missed the root and the one-shot compile failed with operand #3 does not dominate this use.
  • Ran the child’s two-component compiled full-step test against the parent. It errored on a traced Boolean there and passed 3/3 here. Ran the singleton and complex child-solver probes reported above on Julia 1.12.4.
  • Ran GROUP=Core julia --project=lib/<package> -e 'using Pkg; Pkg.test()' for SCCNonlinearSolve and SimpleNonlinearSolve on 1.12.4. Both exited zero. The SCC wrapper suite passed 156/156. Its active item 4 covers the concrete and partial history types, direct, decorated and mixed callbacks, reference solve and recompilation check from the consolidated fixtures. Both changed rootfinding items are included by the Simple Core runner. Simple Core reported four existing broken assertions.
  • uv run --locked python --version printed Python 3.13.13. uv reported that the lock flag had no effect outside a project. The checkout has no Python project or uv lockfile.

What I did not verify

Hosted CI, GPU hardware, downstream packages, QA groups, documentation builds and benchmark execution. The CI header records the supplied status. The independent failure probes ran on Julia 1.12.4.

AUTHOR_GRADE: {"task":"feature","score":3,"difficulty":5,"rounds":5,"author_harness":"Codex CLI 0.171.0","author_model":"gpt-6.1-terra","note":"Both prior blockers are fixed in the merged parent paths. Both Reactant suites and both child Core groups passed. Independent probes exposed singleton initialization and complex secant failures in the child's simple Broyden path."}

Head link: d52d7b8


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a21748-83e1-7f41-9cb5-9aa816726d73 (no session URL)

codex and others added 4 commits November 26, 2026 10:45
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.171.0
Agent-Model: gpt-6.1-terra
Agent-Job: SciML__NonlinearSolve.jl__1213--20261126T112148Z-codex-gpt-6.1-terra
Agent-Session: local session 01a21797-41fc-78a0-8ded-20cecc276f8e (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)
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)
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__1213--20261126T162810Z-codex-gpt-6.1-terra
Agent-Session: local session 01a218af-b235-7f81-83d1-cf471346ccd3 (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: #1213

Reviewed head: 94ce686
Raw SHA-256: a73835d8cd67abde9f60182fdf9260595315607d9742705f78bd5d4aafebca76
Source SHA-256: 769bf909510002d1d85c36d851d5e1c7bacf829b0aca695fed74222a356da5eb
Source: standard-review-v1 (harness-log)
Reviewer session: 01a218d6-cb03-7fc2-8e63-72998b65cce8
Slot: 2
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: high (H6)
  • Verdict: MERGE
  • Reviewed head: 94ce686

Review report

VERDICT: MERGE
Round: 6
Head: 94ce686
Slot: 2
CI: CI is not green
Session: 01a218d6-cb03-7fc2-8e63-72998b65cce8
Reviewer: codex-cli 0.170.0; model: gpt-6.2-astra

Risk

high (H6: .github/workflows/benchmark.yml executes PR-head benchmark/test_sources.jl on the LTS runner, and AGENTS.md changes instructions governing pre-push validation and base merges.) Keeping these changes requires an explicit owner decision.

  • Blocking priorities: none

Blocking findings

None. Both previous numerical blockers are resolved, and the final hosted matrix matches the parent.

Non-blocking findings

The complex-step correction allocates a vector on every real dense Broyden update. At lib/SimpleNonlinearSolve/src/broyden.jl:102, conj.(δx) copies a real step even though conjugation leaves its elements unchanged. On Julia 1.12.4 the warmed matrix-vector operation allocated 1,120 bytes for 128 Float64 values, up from zero. An eight-step in-place solve at that size allocated 282,256 bytes on the merge versus 273,360 on the previous head. Both evaluated the residual nine times.

Implementation fix: In the SimpleBroyden method of SciMLBase.__solve, pass δx directly for real elements. For complex elements, broadcast the conjugate into the existing δJ⁻¹n scratch before the multiplication. Its next assignment overwrites it. In lib/SimpleNonlinearSolve/test/core/rootfind_tests__item3.jl, exercise the production right-factor multiplication with preallocated dense buffers and assert zero warmed allocations for real vectors and the correct conjugated result for complex vectors. The limited-memory dense fallback uses the same method.

What I ran

  • Compared the supplied delta with git diff d52d7b80..HEAD byte-for-byte. Checked all 80 stacked paths with rename detection. The child diff against the final parent has 24 files, 831 additions and 314 deletions. The simple solver and its Reactant test match the first parent exactly. The quasi-Newton sublibrary and diagonal tests match the second parent exactly. git diff --check and typos passed. The checkout stayed clean.
  • In a scratch snapshot, ran julia --project=test/Reactant with Pkg.instantiate() and the full test/Reactant/reactant_tests.jl group body. Julia 1.12.4 and Reactant 0.2.309 passed 861/861, including 140/140 in simple_tests.jl with its normal helpers and 120/120 in diagonal_tests.jl.
  • Ran independent host and CPU @jit probes with both simple Broyden algorithms and identical dependencies on both revisions. For f(x,p) = x ./ 2 .- p, I used a nonzero singleton start and a two-component target ComplexF32[1+2im, 2-im]. I checked the exact two-step root, recomputed residual, reported residual and return code. The previous head produced 12 passes, 12 failures and two scalar-indexing errors. The merge passed 32/32.
  • Ran GROUP=Core julia --project=lib/<package> -e 'using Pkg; Pkg.test()' for SimpleNonlinearSolve, SCCNonlinearSolve and NonlinearSolveQuasiNewton. All exited zero. SCC item 4 passed 156/156 and retains item 8’s wrapper-history, reference-solve and recompilation checks. Both changed simple rootfinding items are wired into Core. Simple Core reported four existing broken assertions.
  • Monitored the exact head through completion. All 119 successful and three skipped check runs matched the parent by name and conclusion. Both hosted Reactant logs report 861/861, on Julia 1.12.4 and Julia 1.13.4. The sole workflow failure was Dependabot Auto-merge at startup on both the reviewed head and the parent head.
  • uv run --locked python --version printed Python 3.13.13. The checkout has no Python project or uv lockfile, and uv reported that the lock flag had no effect.

What I did not verify

I used hosted results for macOS, CUDA, QA, docs, downstream and benchmarks. The allocation probe measured bytes, not elapsed solve time.

AUTHOR_GRADE: {"task":"feature","score":4,"difficulty":5,"rounds":6,"author_harness":"Codex CLI 0.170.0","author_model":"gpt-6.1-terra","note":"Both prior failures reproduced on the old head and passed on the merge. All 861 Reactant assertions passed locally and on both hosted Julia versions. The complex-step fix introduces an avoidable allocation for real vectors."}

Head link: 94ce686


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-astra
Conversation: local session 01a218d6-cb03-7fc2-8e63-72998b65cce8 (no session URL)

ChrisRackauckas and others added 4 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.170.0
Agent-Model: gpt-6.1-terra
Agent-Job: SciML__NonlinearSolve.jl__1213--20261127T040503Z-codex-gpt-6.1-terra
Agent-Session: local session 01a21b2e-3cd5-7340-b6c8-a0bacdbc6c33 (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)
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__1213--20261128T041153Z-codex-gpt-6.1-terra
Agent-Session: local session 01a2205b-7b07-7c72-86a9-a490f6dd07e6 (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.

3 participants