Skip to content

Add ModABNewton: ModAB's bisection phase, then NewtonBisection's steps - #1377

Draft
ChrisRackauckas wants to merge 10 commits into
newton-bisection-autodifffrom
modab-newton
Draft

ChrisRackauckas wants to merge 10 commits into
newton-bisection-autodifffrom
modab-newton

Conversation

@ChrisRackauckas

@ChrisRackauckas ChrisRackauckas commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

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

Adds ModABNewton, which bisects until ModAB's linearity test passes, then uses safeguarded Newton steps. Its prerequisite branches own the Newton safeguards and the Dual-wrapper fixes, so this layer contains the algorithm, documentation and its own tests. The study reports marginal function-evaluation gains and fewer derivative calls; whether this public method is worth merging remains Chris's decision.

Please ignore until reviewed by @ChrisRackauckas. Part of #1377 (#1377).

Failing before / passing after

Integer inputs use positive, negative and reversed brackets, default and zero absolute tolerance, analytic and ForwardDiff derivatives. The unchanged fixture has 32 errors before normalization, and 128 passing assertions after it. Signed sqrt(big(2)) supplies an independent root reference.

julia +1.12 --project="$VALIDATION_ENV" -e 'using Test, SciMLBase; include(ARGS[1])' "$INTEGER_TESTS"
Test Summary:                                                 | Error  Total  Time
Integer brackets                                              |    32     32  3.6s
Test Summary:    | Pass  Total  Time
Integer brackets |  128    128  1.4s

The cached-Jacobian fixture stores 2x in the residual callback and asserts that every Jacobian call uses that same point. The unchanged test fails 12 ordering assertions before the handoff refresh and passes afterward. The number of derivative calls changes because the cached derivative becomes correct; no assertions or tolerances were weakened.

julia +1.12 --project="$VALIDATION_ENV" -e 'using Test, SciMLBase; include(ARGS[1])' "$CACHE_TESTS"
Test Summary:                           | Pass  Fail  Total  Time
User Jacobian shares the residual cache |  104    12    116  3.7s
Test Summary:                           | Pass  Total  Time
User Jacobian shares the residual cache |  104    104  1.4s

Verification

NONLINEARSOLVE_TEST_GROUP=Core julia +1.10 --project="$VALIDATION_ENV" -e 'using Pkg; Pkg.test("BracketingNonlinearSolve")'
Test Summary: | Pass  Total  Time
ModABNewton   | 1413   1413  8.0s
Test Summary:                       | Pass  Total  Time
ModABNewton cached Jacobian handoff |  104    104  1.2s
Test Summary:                            | Pass  Total  Time
Derivative methods with integer brackets |  128    128  1.0s
     Testing BracketingNonlinearSolve tests passed 
NONLINEARSOLVE_TEST_GROUP=Core julia +1.12 --project=lib/BracketingNonlinearSolve -e 'using Pkg; Pkg.test()'
Test Summary: | Pass  Total  Time
ModABNewton   | 1413   1413  9.2s
Test Summary:                       | Pass  Total  Time
ModABNewton cached Jacobian handoff |  104    104  1.3s
Test Summary:                            | Pass  Total  Time
Derivative methods with integer brackets |  128    128  1.2s
     Testing BracketingNonlinearSolve tests passed 
NONLINEARSOLVE_TEST_GROUP=QA julia +1.12 --project=lib/BracketingNonlinearSolve -e 'using Pkg; Pkg.test()'
  [8e850b90] + libblastrampoline_jll v5.15.0+0
  [8e850ede] + nghttp2_jll v1.64.0+1
  [3f19e933] + p7zip_jll v17.7.0+0
        Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
Test Summary: | Pass  Total   Time
QA            |   20     20  34.3s
     Testing BracketingNonlinearSolve tests passed 

Root QA, GROUP=QA julia +1.10 --project="$ROOT_VALIDATION_ENV" -e 'using Pkg; Pkg.test("NonlinearSolve")':

  [8e850b90] + libblastrampoline_jll v5.11.0+0
  [8e850ede] + nghttp2_jll v1.52.0+1
  [3f19e933] + p7zip_jll v17.6.1+0
        Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
Test Summary: | Pass  Total     Time
QA            |   26     26  3m16.0s
     Testing NonlinearSolve tests passed 

Validation environments were separate local environments. For Julia 1.10, SciMLBase 3.58 was added first, then the local sublibraries and root were developed. Formatting and spelling were checked with Runic, git diff --check, and typos --config .typos.toml on the staged diff.

Stack and coverage

The owned prerequisite branches contain the numerical and wrapper fixes, with failing-before/passing-after evidence in #1375 and #1376. This PR reuses their scale, NaN and allocation fixtures by adding ModABNewton to constructor loops. Both final Core runs retain all 24,719 assertions, including 1,413 method-specific assertions.

The ModABNewton follow-up normalizes integer brackets before derivative preparation and refreshes a user residual cache before requesting a derivative at an older endpoint. The shared floating-bracket helper belongs to the Newton prerequisite. The docstrings explicitly import ADTypes: AutoForwardDiff; source history is preserved with normal merge commits.

Documentation

julia +1.12 --project="$DOCS_ENV" docs/make.jl
[ Info: Doctest: running doctests.
[ Info: CheckDocument: running document checks.
[ Info: HTMLWriter: rendering HTML pages.
┌ Warning: Documenter could not auto-detect the building environment. Skipping deployment.

The build on 377e506d exited zero. It reports HTML/search-size warnings and SVG fallbacks for large examples with unchanged build settings. The separate docs environment develops this checkout and its local sublibraries.

Root Core LTS

GROUP=Core julia +lts --project="$ROOT_VALIDATION_ENV" -e 'using Pkg; Pkg.test("NonlinearSolve")'
 23.223363 seconds (16.43 M allocations: 1.126 GiB, 1.24% gc time, 99.82% compilation time)
Test Summary:                                             | Pass  Total   Time
FastShortcutHomotopyPolyalg + homotopy initialization_alg |   12     12  23.4s
 23.368343 seconds (18.53 M allocations: 1.321 GiB, 2.71% gc time, 99.80% compilation time)
     Testing NonlinearSolve tests passed 

The run on 377e506d passed 1,572 assertions with 91 existing broken assertions across 82 testsets. No broken or skipped markers were added.

Not verified

GPU, downstream, prerelease, other platforms, and a complete downgrade matrix were not rerun locally. The stack raises the SciMLBase minimum to 3.57, which exposes the SCC downgrade incompatibility; the base selection at 3.46 passes. This remains blocked on the open compatible SCC prerequisite; no tests were weakened or silenced. Full study wall-time benchmarks were not rerun.

Reviewer decisions

Chris retains the public API decision, acceptance of the two MIT dependencies in the AD layer, the value of adding ModABNewton, and how the original NewtonBisection branch should integrate master. No changes are pushed to that original author's branch. The cache-safe handoff adds one residual evaluation when it selects an older endpoint; a reviewer should assess that cost against the shared-computation callback benefit. The study benchmarks were not rerun after this change.

Independent review

Fresh Codex CLI 0.163.0 / gpt-6.1-sol review of 377e506d against the actual AD base returned CHANGES, medium-low ML7. Session: local session 01a15d0f-d831-7621-b61b-d7bcf6569b5b (no session URL). Its sole blocker is the inherited SCC compatibility prerequisite: an independent exact-minimum probe fails the solution-original concreteness invariant with SciMLBase 3.57, passes on the archived base at 3.46, and agrees with the retrieved SCC downgrade log. The prerequisite remains open.

The reviewer independently reproduced Core 24,719 on each Julia version, sub QA 20/root QA 26, root Core LTS 1,572 passes with 91 existing broken assertions, and docs exit zero. Its head probes pass 128 integer, 104 cache-ordering and 48 additional analytic root/derivative assertions. In-memory negative controls independently reproduce the 32 integer errors and 12 cache-ordering failures. No additional numerical blocker was found; placement, retained coverage, normal merges, Runic, spelling and whitespace were checked.

Its non-blocking request concerns the older body captured when the review began: it still listed 24,487 tests and runtime equality with 930625dd. The current body reports 24,719 and describes the integer/cache changes explicitly; it makes no runtime-equality claim. The fresh AD review also independently tests this final head and confirms both fixes. AD review summary.

Earlier reviewers confirmed two inherited shared follow-ups: sensitivity secant sampling outside tiny brackets with captured Dual state, and Float32 Dual reconstruction with a Float64-promoting residual. Neither is claimed fixed here. No clean stack verdict is claimed while SCC is unresolved.

Downstream CI classification

All three current heads fail ModelingToolkit InterfaceI at the same causal-connection equation orientation assertion, lib/ModelingToolkitBase/test/components.jl:446: multiplicity, AD, ModABNewton. Each actual log selects 207f39e2, the merge of SciML/ModelingToolkit.jl#5295. ModelingToolkit's own master CI fails the identical assertion without this stack. The older passing NonlinearSolve base integration uses an earlier downstream revision and Symbolics/SymbolicUtils versions. All comparison logs were read.

CI rechecked 2026-10-21 22:40 UTC: ModABNewton and its actual AD base each have 56 successful checks and the same single ModelingToolkit failure; multiplicity has 80 successes, the ModelingToolkit and SCC failures, and three skips. No checks remain pending. The latest ModelingToolkit master InterfaceI run at fe189a7e still fails the identical assertion (1,590 passed, one failed, three broken); its actual log was read. The routed CHANGES verdict remains blocked on the separate, unmerged SCC prerequisite. No new source commit or push is claimed for this audit. AD Ubuntu LTS Core reports success on the current AD head. No causal-connection test is changed. This upstream failure is separate from the SCC downgrade compatibility regression exposed by the raised SciMLBase minimum; neither is claimed fixed.

Links

Risk assessment

  • Risk: medium
  • Blast radius: new derivative-using scalar bracketing methods and interval Dual handling; public API requires Chris's decision.
  • Evidence: executed negative controls and local test output above.
  • Independent review: Codex CLI 0.163.0 / gpt-6.1-sol rated final head 377e506 medium-low ML7, confidence not separately stated, CHANGES solely for the SCC prerequisite; no additional numerical blocker. Summary.
  • Merge: blocked on SCC compatibility; needs human review for the public API, dependency and method-value decisions.

🤖 Posted by an AI agent — harness: Codex CLI 0.163.0 · model: gpt-6.1-sol
Conversation: local job 1377-codex (no session URL)

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

Risk assessment (independent review, Codex CLI (gpt-6.1-sol), local job oss-reviews-2026-10-22-SciML-NonlinearSolve-jl-1377-377e506 (no session URL), head 377e506)

  • Verdict: CHANGES
  • Risk: medium-low (ML7)
  • Summary: The new solver passes independent numerical and regression checks, but the inherited SCC compatibility prerequisite remains unresolved and the docstring overstates derivative savings.
  • Merge: needs changes — fix the review findings below

Executed review notes (head 377e506):

Findings

  1. lib/SCCNonlinearSolve/src/SCCNonlinearSolve.jl:139 — blocking (inherited merge prerequisite). The vector SCC path constructs ST by supplying ten NonlinearSolution type parameters. With SciMLBase 3.57, the supported minimum already required by the bracketing prerequisite, that leaves a type parameter free: isconcretetype(eltype(Vector{ST}(undef, 2))) is false. The existing assertion at lib/SCCNonlinearSolve/test/core_tests__item4.jl:100 requires it to be true, and the vector is retained as original when requested. The same construction is concrete on SciMLBase 3.46. I reproduced this type invariant at both exact versions and at 3.58; I did not run the full SCC solver suite. This code and the raised bracketing minimum are unchanged relative to this PR's actual merge-base, so this is not a regression introduced by ModABNewton. It corroborates the body’s explicitly unresolved SCC prerequisite (Keep spelled NonlinearSolution element type concrete across SciMLBase layouts #1332). Resolve that prerequisite and demonstrate the existing SCC test passing before merging the stack; do not weaken the assertion. The risk policy's merge gates apply independently of the additive diff's ML7 rating.

  2. lib/BracketingNonlinearSolve/src/modab_newton.jl:12 — should-fix. “The method needs fewer evaluations of f' than NewtonBisection” is not generally true. For f(x) = atan(x) - atan(1.3), jac(x) = 1/(1+x^2), bounds (-100.0, 100.0), and abstol=0.0, I measured 12 derivative calls and 16 residual calls for ModABNewton versus 8 and 9 for NewtonBisection. Both succeed at the same root. Even bounds (-10.0, 10.0) give 9 versus 8 derivative calls. The three-point linearity heuristic also does not establish that derivatives are used “only near the root.” Describe these as tendencies or motivations, with problem-dependent cost, rather than guarantees. This does not invalidate the three specific derivative-count tests, which pass.

Evidence

Risk was assessed from the diff before opening the PR body, recorded in tmp/risk-before-body.txt. Matched criteria: L1 (documentation), L2 (new tests and expanded constructor loops without weakening assertions), L7 (small internal extraction of the existing Newton iteration), and ML7 (documented/tested exported ModABNewton). Highest: medium-low (ML7). The change reaches an opt-in scalar bracketing solver and its ForwardDiff wrappers; the default ModAB selection and the main NonlinearSolve polyalgorithm are unchanged.

The supplied diff exactly matches the local merge-base comparison:

git -C repo merge-base HEAD origin/newton-bisection-autodiff
**695446ab312d90ae32b559ea3a1c0ba1ab7e32de**
git -C repo diff 695446ab312d90ae32b559ea3a1c0ba1ab7e32de HEAD > tmp/recomputed.diff
cmp pr.diff tmp/recomputed.diff
**exit 0; no output**
git -C repo diff --check 695446ab HEAD
**exit 0; no output**

All execution used scratch copies/environments, Julia 1.12.7, JULIA_NUM_THREADS=4, and timeout 2400. Head was copied with cp -a repo tmp/head; base was extracted with git archive 695446ab… | tar -x -C tmp/base. tmp/setup.jl develops the scratch BracketingNonlinearSolve and NonlinearSolveBase packages and installs the test tools. The environments resolve SciMLBase 3.58.0. The Core drivers include the package's unchanged Muller and root-finding test entry points, wrapped in a single testset.

JULIA_NUM_THREADS=4 timeout 2400 julia --startup-file=no --project=tmp/env tmp/run_core.jl > tmp/core-head.log 2>&1
JULIA_NUM_THREADS=4 timeout 2400 julia --startup-file=no --project=tmp/base-env tmp/run_base.jl > tmp/core-base.log 2>&1

Real output (both exit 0):

**head**
Julia=1.12.7 threads=4
SciMLBase=3.58.0
Test Summary:   |  Pass  Total     Time
Bracketing Core | 24719  24719  1m00.9s
**base**
Julia=1.12.7 threads=4
SciMLBase=3.58.0
Test Summary:   |  Pass  Total   Time
Bracketing Core | 22343  22343  56.4s

Thus I independently reproduced the body's head total. The suite includes analytic square-root references, parameter sensitivities, reversed/integer/Float32/Float64/BigFloat brackets, undefined residuals, scale safeguards, cache ordering, inference and zero-allocation assertions. Existing assertions remain intact; no deleted tests, loosened tolerances, or new broken/skipped markers were found. G1 has independent reference evidence, the changed ForwardDiff paths are exercised, and the cache test satisfies G3.

JULIA_NUM_THREADS=4 timeout 2400 julia --startup-file=no --project=tmp/env -e 'include(ARGS[1])' tmp/head/lib/BracketingNonlinearSolve/test/qa/qa.jl > tmp/qa.log 2>&1
Test Summary:     | Pass  Total   Time
Quality Assurance |   20     20  26.8s

tmp/equality.jl compares existing NewtonBisection (analytic and ForwardDiff derivatives) and ModAB calls for nine quadratic parameters and both bracket directions. It records the bits of u, resid, left, and right, plus the return code.

JULIA_NUM_THREADS=4 timeout 2400 julia --startup-file=no --project=tmp/env tmp/equality.jl > tmp/equality-head.log 2>&1
JULIA_NUM_THREADS=4 timeout 2400 julia --startup-file=no --project=tmp/base-env tmp/equality.jl > tmp/equality-base.log 2>&1
cmp tmp/equality-base.log tmp/equality-head.log
wc -l tmp/equality-base.log
**cmp: exit 0, no output**
72 tmp/equality-base.log

Independent probes (tmp/probes.jl, tmp/count_probe.jl) check shifted exponential roots against their analytic values and count actual callbacks:

JULIA_NUM_THREADS=4 timeout 2400 julia --startup-file=no --project=tmp/env tmp/probes.jl > tmp/probes-corrected.log 2>&1
JULIA_NUM_THREADS=4 timeout 2400 julia --startup-file=no --project=tmp/env tmp/count_probe.jl > tmp/counts.log 2>&1
Test Summary:             | Pass  Total  Time
Additional analytic roots |  108    108  2.0s
atan(x)-atan(1.3) bounds=(-100.0,100.0) ModABNewton=(nf = 16, nj = 12, retcode = SciMLBase.ReturnCode.Success, u = 1.3000000000000003) NewtonBisection=(nf = 9, nj = 8, retcode = SciMLBase.ReturnCode.Success, u = 1.3000000000000003)

The exponential probe initially demanded strict analytic enclosure even when the computed residual rounded to exactly zero (48 pass/24 fail). That was an invalid reviewer assertion for exp(x-r)-1; the final probe checks reference accuracy within eight epsilons and exact-zero/opposite-sign residuals instead. It passes all 108 assertions.

Scratch-only negative controls preserve the PR's assertions. Disabling the residual refresh before the Jacobian handoff produces the body's 12 ordering failures. Replacing the shared floating-bracket normalization with the pre-normalization expression produces 32 integer errors. These are controlled mutations, not failures of the actual merge-base, which does not contain ModABNewton.

JULIA_NUM_THREADS=4 timeout 2400 julia --startup-file=no --project=tmp/env tmp/negative_control.jl cache > tmp/negative-cache.log 2>&1
JULIA_NUM_THREADS=4 timeout 2400 julia --startup-file=no --project=tmp/env -e 'using Test, BracketingNonlinearSolve; @eval BracketingNonlinearSolve floating_bracket(tspan) = minmax(promote(tspan...)...); include(ARGS[1])' tmp/head/lib/BracketingNonlinearSolve/test/newton_input_tests.jl > tmp/negative-integer-both.log 2>&1
Test Summary:                           | Pass  Fail  Total  Time
User Jacobian shares the residual cache |  104    12    116  3.6s
Test Summary:                                                 | Error  Total  Time
Integer brackets                                              |    32     32  3.2s

The corresponding unchanged head fixtures pass in Core (104 cache and 128 integer assertions). The negative controls demonstrate that these tests discriminate the defects described in the body.

For finding 1, tmp/setup_scc_types.jl installs exact SciMLBase versions in separate scratch environments. tmp/scc_types.jl reproduces the type expression at SCC source lines 139–143 and the existing test's concreteness predicate:

JULIA_PKG_PRECOMPILE_AUTO=0 JULIA_NUM_THREADS=4 timeout 2400 julia --startup-file=no --project=tmp/env tmp/setup_scc_types.jl > tmp/scc-setup.log 2>&1
JULIA_NUM_THREADS=4 timeout 2400 julia --startup-file=no --project=tmp/scimlbase-3.57.0 tmp/scc_types.jl > tmp/scc-types-3.57.log 2>&1
JULIA_NUM_THREADS=4 timeout 2400 julia --startup-file=no --project=tmp/scimlbase-3.46.0 tmp/scc_types.jl > tmp/scc-types-3.46.log 2>&1
SciMLBase=3.57.0 SCC original element type concrete=false
SCC core_tests__item4.jl:100 predicate=false
SCC source/test pinned type parameters=10; SciMLBase NonlinearSolution type parameters=11
SciMLBase=3.46.0 SCC original element type concrete=true
SCC core_tests__item4.jl:100 predicate=true
SCC source/test pinned type parameters=10; SciMLBase NonlinearSolution type parameters=10

Public API/SemVer: the export, constructor, docs entry and solve methods are additive; no existing signatures or defaults change. This addition is suitable for a minor release. No Project.toml, dependency, compatibility, or licence changes occur in this diff; ADTypes/DifferentiationInterface already belong to the base. The inherited dependency additions need their prerequisite review, rather than being counted as new dependencies here.

The supplied pr.json CI snapshot contains 56 SUCCESS / 1 FAILURE. The failure is ModelingToolkit InterfaceI, job 119066901153; the body attributes it to an upstream connector assertion. I did not independently retrieve that job log or confirm the attribution. The body correctly avoids claiming an entirely green matrix and discloses the SCC prerequisite and missing final wall-time benchmarks. Its local Core and sublibrary QA counts were independently reproduced here. Final git -C repo status --porcelain=v1 produced no output; no repo edits, commits, pushes or GitHub posts were made.

Not verified

  • Full SCC solver/downgrade suite or a repaired SCC prerequisite; the reproduced failure is its exact type invariant, not a full solve.
  • Root NonlinearSolve Core/QA, docs build, Julia 1.10/prerelease, other platforms, GPU and downstream runs. The supplied snapshot/body provide claims about those checks, not local reproduction by this review.
  • Independent upstream classification of the failed ModelingToolkit CI job or live CI state after the supplied snapshot.
  • AD backends other than ForwardDiff; unavailable-backend errors are covered, but Enzyme/Mooncake/reverse-mode execution was not run.
  • Final wall-time study or load-time/invalidation measurements after the cache refresh. Callback counts alone do not establish a performance benefit.
  • The inherited tiny-bracket captured-Dual sensitivity and mixed Float32/Float64 Dual reconstruction follow-ups acknowledged in the body.

🤖 Posted by an AI agent — harness: Codex CLI · model: gpt-6.1-sol (independent reviewer; appended by Antigravity CLI · model: gemini-4-argon-high)
Conversation: local job oss-reviews-2026-10-22-SciML-NonlinearSolve-jl-1377-377e506 (no session URL)

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

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

The assigned ModelingToolkit InterfaceI failure is pre-existing / obsolete upstream evidence. I read the PR's failed run and ModelingToolkit's historical master failure: both fail the same causal-equation assertion at components.jl:446, with actual input ~ output and expected output ~ input (1,590 passes, one failure, three existing broken assertions). ModelingToolkit repaired that expectation in 9c1625d9. The latest NonlinearSolve default-branch IntegrationTest is a push run at d254af93; its actual InterfaceI log passes 1,704 assertions with three existing broken assertions using ModelingToolkit a62e8516, which contains that repair. This does not establish a regression caused by this PR. No NonlinearSolve runtime change is made for that failure.

The appended review's docstring finding is corrected: derivative savings are described as dependent on the function and initial bracket. I reproduced its counterexample, atan(x) - atan(1.3) with analytic derivative, bounds (-100, 100) and abstol=0: ModABNewton uses 16 residual / 12 derivative calls versus NewtonBisection's 9 / 8; both return 1.3000000000000003. A scratch assertion of the unconditional derivative-saving claim fails as 12 < 8 (four root/success assertions pass). This is a documentation correction; no runtime fix or changed test expectation is claimed.

Local verification

Julia 1.12.7, JULIA_NUM_THREADS=4, JULIA_NUM_PRECOMPILE_TASKS=1, JULIA_PKG_PRECOMPILE_AUTO=0, writable job-specific TMPDIR. JULIA below selects the installed juliaup launcher; DIFF denotes the captured patch.

JULIA="$(dirname "$(command -v juliaup)")/julia"
timeout 3600 "$JULIA" +1.12 --project=@runic -m Runic --inplace lib/BracketingNonlinearSolve/src/modab_newton.jl
typos --config .typos.toml "$DIFF"
git diff --check

All three exit 0 with no output. The commit adds two docstring lines and deletes three; it changes no runtime code, dependencies, or official tests.

GROUP=Core timeout 3600 "$JULIA" +1.12 --project=lib/BracketingNonlinearSolve -e 'using Pkg; Pkg.test()'

The full group passed both before and after the documentation edit, 24,719 assertions per run. Tail of the final run:

Test Summary: | Pass  Total  Time
ModABNewton   | 1413   1413  5.8s
Test Summary:                       | Pass  Total  Time
ModABNewton cached Jacobian handoff |  104    104  0.9s
Test Summary:                            | Pass  Total  Time
Derivative methods with integer brackets |  128    128  0.7s
     Testing BracketingNonlinearSolve tests passed
GROUP=QA timeout 3600 "$JULIA" +1.12 --project=lib/BracketingNonlinearSolve -e 'using Pkg; Pkg.test()'
Test Summary: | Pass  Total   Time
QA            |   20     20  26.4s
     Testing BracketingNonlinearSolve tests passed
GROUP=QA timeout 3600 "$JULIA" +1.12 --project -e 'using Pkg; Pkg.test()'
Test Summary: | Pass  Total     Time
QA            |   28     28  5m37.8s
     Testing NonlinearSolve tests passed
timeout 3600 "$JULIA" +1.12 --project=docs -e 'using Pkg; Pkg.instantiate()'
timeout 3600 "$JULIA" +1.12 --project=docs docs/make.jl

Instantiation exits 0. The docs command exits 1 before Documenter runs, while importing TaylorDiff through NonlinearSolveHomotopyContinuation. I also ran the same build in a clean checkout of current default d254af933dd48eeb9b21b4a55f643e92a0840ff6, using the same resolved Manifest with relative local-package paths. That checkout has no tracked modifications and fails identically. Its command, with BASE_DOCS denoting that clean checkout's docs directory:

timeout 3600 "$JULIA" +1.12 --project="$BASE_DOCS" "$BASE_DOCS/make.jl"

Error excerpt from both runs:

ERROR: LoadError: TypeError: non-boolean (Symbolics.Num) used in boolean context

The trace enters ChainRules.derivatives_given_output for tanh, then TaylorDiff's get_term_raiser. Resolved versions are ChainRules 1.74.11, TaylorDiff 0.3.5, Symbolics 7.48.0. No docs settings, examples, tests, or dependency bounds were changed to bypass it. A successful local docs build is not claimed.

A separate dependency-only reproduction imports no SciML package:

using InteractiveUtils
using ChainRules, ChainRulesCore, Symbolics
versioninfo()
@variables z
println(frule((NoTangent(), true), tanh, z))

In clean scratch environments, this unchanged script exits 0 with ChainRules 1.74.10 and prints (tanh(z), 1 - (tanh(z)^2)); it exits 1 with ChainRules 1.74.11 and the same non-Boolean Num error. Both use Julia 1.12.7, ChainRulesCore 1.26.8, Symbolics 7.48.0 and SymbolicUtils 4.55.0; comparing the manifests finds only the ChainRules version/tree differs. Source history identifies the introducing commit as a6107e9b, which adds a Boolean branch to the tanh derivative. This dependency regression is separate from the historical ModelingToolkit failure. No upstream issue was filed from this fixer job.

Remaining review state

The SCC compatibility prerequisite remains open and untouched. Its inherited merge blocker is not claimed fixed. Current-head ModelingToolkit InterfaceI was not rerun locally; the default comparison above is executed CI-log evidence. GPU, prerelease, other platforms, SCC solver/downgrade suites, inherited AD edge-case follow-ups and benchmarks were not rerun. CI started on 340c16db; it was checked once and is not being awaited here.

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

Links


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

ModABNewton bisects without derivatives until f looks linear on the
bracket by ModAB's test, then continues with NewtonBisection's Newton
steps from the end with the smaller |f|. The derivative is the `jac` of
the IntervalNonlinearFunction, or comes from the `autodiff` backend.

Derivatives are only used near the root, so it needs fewer derivative
evaluations than NewtonBisection, and at multiple roots, where ModAB's
linearity test does not pass, it stays with bisection. The Newton loop of
NewtonBisection is split out as `newton_bisection_steps` so that both use
it.

The ForwardDiff extension handles it like the other methods.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Agent-Harness: Claude Code cloud
Agent-Model: withheld (the harness forbids model identifiers in commits)
Agent-Session: https://claude.ai/code/session_01HJLdhiuK5ih88KyZciWTEH

Copy link
Copy Markdown
Member Author

(AI-generated, Claude Code cloud session: https://claude.ai/code/session_01HJLdhiuK5ih88KyZciWTEH)

The red Tests - Core (Julia lts) check fails on solve!() inference: Error During Test at test/Core/core_tests__item3.jl:27. This is the root package's PolyAlgorithm inference test on Julia 1.10. It fails the same way on master (dd8a550b), and this PR only changes BracketingNonlinearSolve. The fix is #1347; details in #1375 (comment).


Generated by Claude Code

@ChrisRackauckas-Claude

ChrisRackauckas-Claude commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

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

Core LTS classification at 8121a006: pre-existing on master, fixed on current master. Both Linux and macOS fail PolyAlgorithm Type Inference → solve!() inference (test/Core/core_tests__item3.jl:27), matching the earlier master failure. The head lacks the merged retcode type assertion in #1347. The first completed master Core LTS jobs after that fix pass on both platforms.

Links:


🤖 Posted by an AI agent — harness: Codex CLI · model: gpt-6.1-sol
Conversation: local headless job codex-nls-core-lts-20261017 (no session URL)

ChrisRackauckas and others added 2 commits October 19, 2026 14:31
Integrate the Julia LTS inference corrections while preserving author commits.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.163.0
Agent-Model: gpt-6.1-sol
Agent-Session: local session 01a1556d-e323-7f00-82fb-6d484033f65a (no session URL)
Use the existing safe midpoint when adding the endpoints overflows.
Select midpoint arithmetic by algorithm in the shared Newton safeguard so
ModABNewton uses the same fallback in both phases and NewtonBisection
retains its arithmetic. Test analytic roots and bracket containment across
signs, scales, interval orderings, and derivative modes.

Runtime: codex-cli 0.163.0.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.163.0
Agent-Model: gpt-6.1-sol
Agent-Session: local session 01a1556d-e323-7f00-82fb-6d484033f65a (no session URL)
Share the overflow-guarded midpoint between the Newton methods and reject
undefined residuals before updating the enclosing interval. Keep derivative-free
Dual wrapping efficient, give derivative callbacks an explicit out-of-place
trait, and validate unavailable AD backends on the Dual path.

Add analytic containment, failure, allocation, and inference regressions to the
official Bracketing runner.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.163.0
Agent-Model: gpt-6.1-sol
Agent-Session: local session 01a1556d-e323-7f00-82fb-6d484033f65a (no session URL)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

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

Taking this — Codex CLI 0.163.0, model gpt-6.1-sol (job 1377-codex).


🤖 Posted by an AI agent — harness: Codex CLI 0.163.0 · model: gpt-6.1-sol
Conversation: local job 1377-codex (no session URL)

ChrisRackauckas and others added 6 commits October 20, 2026 23:58
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.163.0
Agent-Model: gpt-6.1-sol
Agent-Session: local job 1377-codex (no session URL)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.163.0
Agent-Model: gpt-6.1-sol
Agent-Session: local job 1377-codex (no session URL)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.163.0
Agent-Model: gpt-6.1-sol
Agent-Session: local job 1377-codex (no session URL)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.163.0
Agent-Model: gpt-6.1-sol
Agent-Session: local job 1377-codex (no session URL)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.163.0
Agent-Model: gpt-6.1-sol
Agent-Session: local job 1377-codex (no session URL)
Describe derivative savings as dependent on the function and bracket rather than
a guarantee. The atan counterexample uses 12 derivative calls versus 8 for
NewtonBisection while both methods find the same root.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.164.0
Agent-Model: gpt-6.1-sol
Agent-Session: local fixer job SciML__NonlinearSolve.jl__1377 (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