Skip to content

Make RobustNonMonotoneLineSearch traceable under Reactant.@jit - #112

Merged
ChrisRackauckas merged 12 commits into
SciML:mainfrom
ChrisRackauckas-Claude:agent/ls109x-traceable-nonmonotone
Nov 2, 2026
Merged

ChrisRackauckas merged 12 commits into
SciML:mainfrom
ChrisRackauckas-Claude:agent/ls109x-traceable-nonmonotone

Conversation

@ChrisRackauckas-Claude

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

Copy link
Copy Markdown
Member

Fixes #109

Please ignore this draft until reviewed by @ChrisRackauckas.

RobustNonMonotoneLineSearch supports a bounded Reactant-traced backtracking loop and carried history buffer, allowing a compiled DF-SANE-style caller to reuse the cache. The stacked return-code tests are merged, and both the root package and Reactant test environment require SciMLBase 3.58, whose Reactant extension supports successful_retcode inside compiled callers. Compiled interpolation explicitly propagates NaN ratios so invalid trial residuals produce the same failure as the host.

The host LineSearchSolution type and host search loop are unchanged. Compiled calls return an internal TracedLineSearchSolution exposing step_size and retcode, evaluate both trial directions each iteration, and do not increment function-evaluation statistics. ReactantCore is a hard dependency (MIT); Reactant remains a test-only dependency. Finite extreme merits use a scaled norm under compile.

Changes completing this draft

  • Merged the stacked tests from ChrisRackauckas-Claude@fb7c746 without rewriting history. They check successful and failed searches with SciMLBase.successful_retcode(sol.retcode) inside @jit and after return. The compiled DF-SANE loop stops when the line search fails.
  • Set SciMLBase = "3.58" in the root and Reactant [compat] tables. QA's "3.0" and Enzyme's "2.53.1, 3.17" already allow 3.58; the developed root package enforces the effective floor in those environments.
  • Guarded both compiled interpolation ratios against XLA clamp's NaN-to-bound behavior and added an exact NaN regression. Both initial trial residuals contain NaN; comparisons cannot accept them, and NaN interpolation ratios propagate through all three iterations, so the expected result is step 1.0 / Failure. The expectations follow that host algorithm rule, with no tolerance changes.
  • Merged the current main's CI cancellation update using a normal merge commit. No force push.

Local verification

All logs and scratch environments are under <job>/scratch. Writable depot and temporary/cache directories are job-local; ~/.julia is a read fallback. Julia defaults were not changed.

export TMPDIR=<job>/tmp
export JULIA_DEPOT_PATH=<job>/scratch/depot:~/.julia
export JULIA_PKG_PRECOMPILE_AUTO=0
export JULIA_NUM_PRECOMPILE_TASKS=8
export JULIA_NUM_THREADS=4
export XDG_CACHE_HOME=<job>/scratch/cache
export PYTHONPYCACHEPREFIX=<job>/scratch/pycache
J12=julia

Failing before / passing after

The scratch/before source snapshot has the merged stacked tests, the final NaN test, the unguarded interpolation from ChrisRackauckas-Claude@c6e88d4, and the former SciMLBase compat so that 3.57.0 can resolve. setup_reactant.jl develops that snapshot, adds Reactant 0.2.291 plus the requested exact SciMLBase version, and pins SciMLBase; run_reactant.jl includes the official Reactant test file inside one parent testset. Both environments resolved ReactantCore 0.1.26. The final and before test files have identical SHA-256 hashes.

Commands actually run from the job checkout:

"$J12" --project=../scratch/env357 ../scratch/setup_reactant.jl ../scratch/before 3.57.0
"$J12" --project=../scratch/env358 ../scratch/setup_reactant.jl ../scratch/before 3.58.0
"$J12" --project=../scratch/env357 ../scratch/run_reactant.jl ../scratch/before
"$J12" --project=../scratch/env358 ../scratch/run_reactant.jl ../scratch/before

SciMLBase 3.57.0, exit 1: all three return-code consumers throw the same error:

MethodError: Cannot `convert` an object of type Reactant.TracedEnum{SciMLBase.ReturnCode.T} to an object of type SciMLBase.ReturnCode.T
Test Summary:                                                   | Pass  Fail  Error  Total     Time
Reactant regressions                                            |   55     2      3     60  9m01.6s
  compiled line search matches the host                         |   20                  20  1m11.0s
  compiled line search with NaN trial merits                    |    2     2             4     8.6s
  compiled line search with finite extreme merits               |   18                  18    16.9s
  compiled line search on a scalar residual: unit step rejected |    5                   5     4.6s
  compiled line search on a scalar residual: maxiters reached   |    5                   5     0.3s
  successful_retcode of the compiled return code: success       |    1            1      2     2.3s
  successful_retcode of the compiled return code: failure       |    1            1      2     0.1s
  compiled DF-SANE on u.^3 .- 2                                 |    3            1      4     6.4s

SciMLBase 3.58.0 on the identical unguarded snapshot, exit 1: the return-code tests and DF-SANE pass; only the NaN regression fails:

Evaluated: 0.010000000000000002 == 1.0
Test Summary:                                                   | Pass  Fail  Total     Time
Reactant regressions                                            |   64     2     66  9m09.1s
  compiled line search matches the host                         |   20           20  1m10.9s
  compiled line search with NaN trial merits                    |    2     2      4     8.5s
  compiled line search with finite extreme merits               |   18           18    17.6s
  compiled line search on a scalar residual: unit step rejected |    5            5     4.4s
  compiled line search on a scalar residual: maxiters reached   |    5            5     0.3s
  successful_retcode of the compiled return code: success       |    3            3     2.5s
  successful_retcode of the compiled return code: failure       |    3            3     0.6s
  compiled DF-SANE on u.^3 .- 2                                 |    8            8    12.5s

After developing the fixed checkout into a separate environment with the same Reactant 0.2.291 / SciMLBase 3.58.0 pins:

"$J12" --project=../scratch/env358after -e 'using Pkg; Pkg.develop(path=pwd()); Pkg.status(["SciMLBase", "Reactant", "ReactantCore", "LineSearch"])'
"$J12" --project=../scratch/env358after ../scratch/run_reactant.jl "$PWD"

Exit 0:

Info Packages marked with ⌃ have new versions available and may be upgradable.
Test Summary:        | Pass  Total     Time
Reactant regressions |   66     66  6m35.1s

Required package groups

Root manifest pinned SciMLBase 3.58.0. The Reactant subenvironment was independently pinned to 3.58.0; it resolved Reactant 0.2.294 / ReactantCore 0.1.26. Manifests are not committed.

GROUP=Core "$J12" --project=. -e 'using Pkg; Pkg.test()'
GROUP=QA "$J12" --project=. -e 'using Pkg; Pkg.test()'
GROUP=Reactant "$J12" --project=. -e 'using Pkg; Pkg.test()'

All exited 0. Actual output tails:

Test Summary:        | Pass  Total     Time
Core/armijo_tests.jl |  191    191  3m21.6s
Test Summary:                  | Pass  Total     Time
Core/custom_optimizer_tests.jl |  168    168  4m09.8s
Test Summary:            | Pass  Total   Time
Core/gpu_arrays_tests.jl |  151    151  19.9s
Test Summary:                 | Pass  Total   Time
Core/objective_merit_tests.jl |  107    107  17.4s
Test Summary:              | Pass  Total  Time
Core/optimization_tests.jl |   29     29  2.5s
Test Summary:              | Pass  Total   Time
Core/root_finding_tests.jl |  107    107  30.9s
     Testing LineSearch tests passed

Test Summary:          | Pass  Total     Time
QA/allocation_tests.jl |   30     30  1m32.9s
Test Summary: | Pass  Total   Time
QA/qa.jl      |   21     21  59.5s
     Testing LineSearch tests passed

Test Summary:              | Pass  Total     Time
Reactant/reactant_tests.jl |   66     66  9m54.8s
     Testing LineSearch tests passed

Downgrade reproduction

bash ../scratch/downgrade_repro.sh

Exit 0. This copies the earlier report's downgrade.jl, runs it on Julia 1.10.12 with the stdlib skip list, mode=deps, version 1, and no_promote=Mooncake, then runs Pkg.build(verbose=true) and:

GROUP=All "$J10" --color=no --check-bounds=yes --project=. -e 'using Pkg; Pkg.test(; coverage=false, allow_reresolve=false, force_latest_compatible_version=false)'

Resolved floors: SciMLBase 3.58.0, ReactantCore 0.1.21, SciMLTesting 2.4.0. Actual tail:

Test Summary:        | Pass  Total     Time
Core/armijo_tests.jl |  191    191  2m52.6s
Test Summary:                  | Pass  Total     Time
Core/custom_optimizer_tests.jl |  168    168  2m59.7s
Test Summary:            | Pass  Total   Time
Core/gpu_arrays_tests.jl |  148    148  11.9s
Test Summary:                 | Pass  Total   Time
Core/objective_merit_tests.jl |  107    107  10.9s
Test Summary:              | Pass  Total  Time
Core/optimization_tests.jl |   29     29  1.7s
Test Summary:              | Pass  Total   Time
Core/root_finding_tests.jl |  107    107  20.0s
Test Summary:                            | Pass  Total   Time
LineSearchesJL/custom_optimizer_tests.jl |   96     96  25.0s
Test Summary:                        | Pass  Total   Time
LineSearchesJL/root_finding_tests.jl |   80     80  14.0s
     Testing LineSearch tests passed

Formatting, spelling, docs

"$J12" --project=~/.julia/environments/runic -m Runic --check src test docs
typos src test docs Project.toml
git diff --check origin/main...HEAD

All exited 0; Runic found no formatting differences, and typos emitted no diagnostics.

The docs were built from an identical source copy with Git metadata under scratch/docs-repo, after developing that copy in its docs environment:

cd ../scratch/docs-repo
"$J12" --project=docs docs/make.jl

Exit 0. The first complete build encountered HTTP 429 on the existing ColPrac link; the unchanged retry passed with link checking enabled:

[ Info: Populate: populating indices.
[ Info: RenderDocument: rendering document.
[ Info: HTMLWriter: rendering HTML pages.
[ Info: Automatic `version="0.1.19"` for inventory from ../Project.toml
┌ Warning: Documenter could not auto-detect the building environment. Skipping deployment.
└ @ Documenter ~/.julia/packages/Documenter/13nbQ/src/deployconfig.jl:95

Remote CI verification blocked

As of 2026-10-17 17:45:32 UTC, the seven validation workflows for this head remain queued (61 minutes since creation), with all nine visible checks still QUEUED. There are no new-head test outputs to assess, so no remote CI success is claimed. Main's Tests workflow is also queued; main's format, docs, and downgrade workflows have completed successfully. The scheduling cause is not diagnosed.

The separate Dependabot Auto-merge workflow reports startup_failure on this head (https://github.com/SciML/LineSearch.jl/actions/runs/39050721816). The same conclusion is present on the prior head (https://github.com/SciML/LineSearch.jl/actions/runs/37780607189); its startup cause was not diagnosed here, and it exposes no check-run annotations through the queried endpoint.

CI monitoring is handed to @ChrisRackauckas: read the runs when scheduled and investigate any regression before review/merge. The job stops with a written CI-verification blocker after completing the code and requested local checks.

Not verified

  • Remote CI results for the new head: the validation workflows are still queued after an hour.

  • Enzyme's separate test environment locally; GPU/TPU execution; Julia versions other than 1.12.7 and the 1.10.12 downgrade run.

  • A real NonlinearSolve.DFSane invocation under compile. The test carries the cache through its DF-SANE-style loop and converges in 12 steps; this does not substantiate the original issue's 11-step claim.

  • The traced path with the minimum Reactant 0.2.289 / ReactantCore 0.1.21 pairing. The host downgrade group excludes Reactant as declared in test_groups.toml.

  • Fresh independent review of this head. This job was explicitly assigned to work alone.

Reviewer decisions

The hard ReactantCore dependency and the compiled result's distinct internal container remain design choices for @ChrisRackauckas. Dispatch on host LineSearchSolution does not describe the compiled container. Compiled floating-point arithmetic can differ near acceptance thresholds, and compiled evaluation statistics differ as documented.

Original implementation: Claude Code 2.1.292 (historical commits record the model alias opus; exact model ID unknown), transcript <job>/log.txt. This follow-up: Codex CLI 0.163.0, model gpt-6.1-sol, transcript <job>/log.txt.

Links

Risk assessment

  • Risk: medium
  • Blast radius: the compiled RobustNonMonotone path and every user's minimum SciMLBase resolution; the original draft adds a hard MIT ReactantCore dependency. The host search loop and public LineSearchSolution type are unchanged.
  • Evidence: three return-code errors with SciMLBase 3.57.0 become passing checks with 3.58.0 on identical source; two NaN assertions fail before the guard and pass after; the fixed pinned regression file and required Reactant group each pass 66/66. Core, QA, downgrade All, Runic, typos, and docs passed locally as shown above.
  • Independent review: Devin CLI 3000.11.3 / fusion-claude-opus-5-5-high-sidekick-swe-2-medium rated the earlier head medium, CHANGES, with reproduced NaN and return-code blockers (Make RobustNonMonotoneLineSearch traceable under Reactant.@jit #112 (comment)). The changes here address both with discriminating tests; the new head has not been independently re-reviewed.
  • Merge: needs human review — draft, CI verification blocked by queued workflows, no fresh independent review, hard dependency and compiled result interface decisions. Never merged by this job.

🤖 Generated with Codex CLI 0.163.0 (model: gpt-6.1-sol); local job 112-codex, transcript: /log.txt

ChrisRackauckas and others added 8 commits October 7, 2026 12:14
Under ReactantCore.within_compile(), solve! runs a bounded @trace while
backtracking loop and selects the step and return code with ifelse; the
non-monotone history is a fixed-size traced vector updated with a mask,
and nsteps is traced so a traced solver loop can carry the cache. The
host path is unchanged. LineSearchSolution.retcode becomes a type
parameter so it can hold a traced return code.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Agent-Harness: Claude Code 2.1.292
Agent-Model: opus
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/LineSearch.jl/jobs/ls109x-claude/log.txt on amdci2.julia.csail.mit.edu
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Agent-Harness: Claude Code 2.1.292
Agent-Model: opus
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/LineSearch.jl/jobs/ls109x-claude/log.txt on amdci2.julia.csail.mit.edu
Reactant lowers norm to sqrt(dot(x, x)), which underflows to 0 or
overflows to Inf for finite residuals and changed accepted steps and
return codes. The compiled path scales by maximum(abs, x) for the initial
merit, the history and the trial merits; the host path still calls norm.
Adds compiled regression tests for small Float64/Float32 and large finite
merits.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Agent-Harness: Claude Code 2.1.292
Agent-Model: opus
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/LineSearch.jl/jobs/ls109x-claude/log.txt on amdci2.julia.csail.mit.edu
…en compiled

Making LineSearchSolution.retcode a type parameter broke dispatch on
LineSearchSolution{Float64, Nothing, Nothing}. The compiled solve! of
RobustNonMonotoneLineSearch returns an internal TracedLineSearchSolution
with the same step_size and retcode fields instead.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Agent-Harness: Claude Code 2.1.292
Agent-Model: opus
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/LineSearch.jl/jobs/ls109x-claude/log.txt on amdci2.julia.csail.mit.edu
SciMLTesting runs the "All" groups in one process. In the Downgrade job
(GROUP=All, Julia lts) the root test environment loads LineSearch with the
downgraded ReactantCore 0.1.21 before test/reactant is activated, so the
latest Reactant there fails to precompile (`@annotate` not defined).
in_all = false is SciMLTesting's setting for environment-specific groups;
CI still runs GROUP=Reactant as its own job on Julia 1.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Agent-Harness: Claude Code 2.1.292
Agent-Model: opus
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/LineSearch.jl/jobs/ls109x-claude/log.txt on amdci2.julia.csail.mit.edu
…test

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Agent-Harness: Claude Code 2.1.292
Agent-Model: opus
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/LineSearch.jl/jobs/ls109x-claude/log.txt on amdci2.julia.csail.mit.edu
traced_merit called similar on the residual buffer, which has no method
for a traced scalar. Only in-place residuals need a fresh buffer.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Agent-Harness: Claude Code 2.1.292
Agent-Model: opus
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/LineSearch.jl/jobs/ls109x-claude/log.txt on amdci2.julia.csail.mit.edu
Covers successful and failed searches checked inside @jit and after return,
and makes the DF-SANE test loop stop on a failed line search as
NonlinearSolve's DFSane does. Needs a SciMLBase release with
successful_retcode for traced return codes.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Agent-Harness: Claude Code 2.1.292
Agent-Model: opus
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/LineSearch.jl/jobs/ls109x-claude/log.txt on amdci2.julia.csail.mit.edu
@ChrisRackauckas

Copy link
Copy Markdown
Member

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

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

Full review

VERDICT: CHANGES
RISK: medium

Reviewed head 1eb89a7 (#112, issue #109). Reviewer: Devin CLI, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium. Risk is medium because ReactantCore becomes a hard dependency loaded by every downstream user. The host code path itself is unchanged.

Blocking findings

  1. The compiled path's result differs from the host's when a trial residual is NaN: the host returns Failure, the compiled path returns Success with a different step. Neither the tests nor the docstring cover this. (confirmed by running)

    • Where: src/robust_non_monotone.jl:210-215 (the clamp step-length updates in solve_traced) and the docstring claim at src/robust_non_monotone.jl:36-41.
    • Probe (scratch/probe/probes2.jl): nanf(u,p) = ifelse.(u .< 0, NaN, u.^2 .- 1), u = [0.5, 0.2], du = [-10.0, 3.0], one history entry, default alg and maxiters = 3.
      • Host: (1.0, Failure).
      • @jit: (0.010000000000000002, Success).
    • Root cause (scratch/probe/probes3.jl):
      • The host gives clamp(NaN, 0.1, 0.5) = NaN. Once both trial merits at α = 1 are NaN, both step lengths stay NaN forever, and the host fails for every maxiters (1, 2, 3 and 10 checked).
      • The compiled clamp lowers to an XLA clamp, and @jit clamp(ConcreteRNumber(NaN), 0.1, 0.5) returns 0.1. So the compiled search backtracks by τ_min and accepts.
    • Why it matters:
      • Under compile, out-of-domain residuals (sqrt/log of negatives) produce NaN instead of throwing. This is exactly the regime where compiled DF-SANE will hit the difference.
      • The docstring says the compiled search "follows the same acceptance rule and step-length updates as the host one". It says results "can differ from the host's in the last bits" only at the acceptance threshold. Here the return code itself flips.
    • Required change: pick one.
      • (a) Make the traced update match the host, e.g. r = α₊ * f_norm_old / (...) then α₊ * ifelse(isnan(r), r, clamp(r, τ_min, τ_max)), and likewise for α₋.
      • (b) Keep the compiled behaviour and state the NaN divergence in the docstring.
    • Either way, add this case to test/reactant/reactant_tests.jl with the host value as the expectation (for (a)) or the documented divergence (for (b)). The current test file has no NaN case. The "round-1 probes, 78/78 including NaN/Inf" cited in the PR body did not catch this.
  2. By the PR's own status the PR is not mergeable, and one sentence in the body contradicts that status. (confirmed by running)

    • Inside @jit, SciMLBase.successful_retcode(sol.retcode) throws: MethodError: Cannot convert an object of type Reactant.TracedEnum{SciMLBase.ReturnCode.T} to an object of type SciMLBase.ReturnCode.T. This is with SciMLBase 3.57.0 and Reactant 0.2.291 (scratch/probe/probes2.jl).
    • After return, the value is a Reactant.ConcreteEnum and successful_retcode returns true.
    • Contradiction: the "Details" section says "SciMLBase.successful_retcode accepts the traced code", while the status banner says it throws. The banner is right.
    • The issue's acceptance criterion is "NonlinearSolve's DFSane can reuse the line-search cache under compile". DFSane calls successful_retcode, so the criterion cannot be met until Support successful_retcode on traced Reactant return codes SciMLBase.jl#1637 is released. The SciMLBase compat bump and the test-branch commits (https://github.com/ChrisRackauckas-Claude/LineSearch.jl/tree/agent/ls109x-traced-retcode) also have to land in this PR.
    • Required change: fold those in once SciMLBase #1637 is released, and delete the contradicting sentence from the PR body.

Non-blocking findings

  1. A returned type that is not a declared public name (suspected from reading).
    • TracedLineSearchSolution (src/robust_non_monotone.jl, end of file) is what callers receive from a public function under compile.
    • It has a docstring, but it is not declared public, not exported, and not in docs/.
    • The CLAUDE.md rule is "public and documented move together". Either declare it public with a docs entry, or say explicitly in the docstring that only the field names are the API.
  2. The compiled path evaluates f at -α₋ even when +α₊ was accepted, and skips add_nf! (from reading, as the docstring documents). This is acceptable. But note that a stats passed to init silently stays at zero under compile. A compiled DFSane will therefore report nf lower than the host's.
  3. The DF-SANE "12 steps" claim is partly unchecked (suspected from reading).
    • The test's outer loop (test/reactant/reactant_tests.jl:37-59) starts from σ = dot(u,u)/dot(u,fu). NonlinearSolve's DFSane starts from σ_1.
    • The comment says the 12 steps match solve(NonlinearProblem(cube,u0), DFSane()).stats.nsteps with NonlinearSolve 4.32, and the issue says 11. I did not run NonlinearSolve.
    • The test asserts only its own host loop's 12. That is internally consistent, but it is not evidence about NonlinearSolve's DFSane.
  4. Unverified compat floor. The ReactantCore = "0.1.21" floor is exercised only on the host path (Downgrade runs GROUP=All, which excludes Reactant). Whether the traced path works with a Reactant release paired with ReactantCore 0.1.21 is unverified.
  5. Dependency choice, already flagged in the PR body. A hard dependency rather than a weakdep extension is a design call for the maintainer. ReactantCore is MIT.

What I ran

  • Probe env: scratch/probe (Julia 1.12.7, Reactant 0.2.291, ReactantCore 0.1.25, SciMLBase 3.57.0, LineSearch dev'd from the checkout).
  • probes.jl, a host-vs-@jit fuzz: 3 residuals (cube, trig, quad) × 4 alg settings (M 1/3/10, maxiters 2/4/100, n_exp 1/2, σ₁ 0.5, γ 0.5) × 0/1/4 random history entries × 3 directions, including non-descent ones.
    • 108/108 match on step, retcode and history (rtol 1e-12).
    • Also matched: Float32 u with the default Float64 alg; two consecutive solves on one cache (step, retcode, history, nsteps) for M=10 and M=1; reinit! inside @jit.
  • probes2.jl: the NaN cases (blocking 1) and successful_retcode inside and after @jit (blocking 2).
  • probes3.jl: host vs XLA clamp(NaN, …), host step trace for maxiters 1/2/3/10, and on the host: @inferred solve! passes, the return type is LineSearchSolution{Float64,Nothing,Nothing}, nsteps::Int64, and the cache type is concrete.
  • Copy of the checkout at scratch/repo_copy:
    • GROUP=Reactant julia +1.12 --project -e 'using Pkg; Pkg.test()' → 56/56, tests passed (scratch/reactant_group.log).
    • GROUP=QA → allocation_tests 30/30, qa.jl 21/21, passed (scratch/qa_group.log).
  • Failing before the fix: scratch/repo_main (main's src/ and Project.toml with the PR's test/), GROUP=Reactant → 26 passed, 11 errored (scratch/reactant_group_main.log).
    • All line-search testsets fail with "Scalar indexing is disallowed … setindex!(::TracedRArray…)".
    • DF-SANE fails with "TypeError: non-boolean (TracedRNumber{Bool})".
    • This confirms the tests fail before the fix and pass after it.
  • gh pr checks 112: all green on 1eb89a7, including "tests / Reactant (julia 1)" and "Downgrade Tests - All".
  • Read the full diff. The host path differs from main only in merit_norm (which is norm on the host), maybe_traced(0) (which is 0 on the host) and within_compile() guards. within_compile is @inline … = false in ReactantCore.

What I did not verify

Links


🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (review), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium
Conversation: local Claude session 3c311569-dda6-4687-bc9f-65febb212c33 (fleet master)

ChrisRackauckas and others added 4 commits October 17, 2026 12:27
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 112-codex (transcript kept on the agent host)
The Reactant extension in SciMLBase 3.58 supports successful_retcode on
traced return codes. Enforce that floor in the package and Reactant env.

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 112-codex (transcript kept on the agent host)
Select NaN ratios explicitly before XLA clamp so invalid trials propagate
as on the host. The regression fails twice before the guard and passes
with it; the complete pinned Reactant test file passes 66 assertions.

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 112-codex (transcript kept on the agent host)
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 112-codex (transcript kept on the agent host)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

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

Independent review (Codex CLI 0.166.0 / gpt-6.1-sol), session 01a19712-d0ac-7792-a30c-629778d59d3f, reviewed head 99464aa

  • Verdict: MERGE
  • Risk: medium-low (ML7: adds compiled execution without changing existing ordinary calls; ML8, ML9 and ML4 cover the tested cache state, lightweight MIT dependency and raised compatibility floor).
  • Round / slot: 1 / 1
  • Blocking priorities: none

Review written by the reviewer named above in a session other than the PR author's, and copied here by the posting agent without change to its findings. The posting agent did not re-run the reviewer's commands.

Summary: Adds Reactant-traced robust non-monotone line search with carried history, stable merits and traced return codes while preserving ordinary execution. The added regression file fails on the merge-base and passes on the reviewed head, and all visible validation checks pass.

Blast radius: RobustNonMonotoneLineSearch initialization, compiled solve!, callback history and reinit!; dependency resolution now requires SciMLBase 3.58 and ReactantCore 0.1.21 or later. Ordinary LineSearchSolution and the ordinary acceptance loop remain intact.

Evidence: Blind assessment frozen and SHA-256 hashed before author context. Julia 1.13.2, Reactant 0.2.294, ReactantCore 0.1.26 and SciMLBase 3.58.0: the identical added Reactant test file fails on the merge-base (exit 1; 30 pass, 14 errors) and passes on the head (exit 0; 66/66). CI Reactant also passes 66/66; all 15 visible checks pass. The independent analytical probe also passes 30/30 assertions, including exact history wraparound/reinit! checks. Numerical references include cbrt(2), analytic linear-residual steps and extreme-magnitude history values.

Blocking findings

None.

Non-blocking findings

None.

What I ran

All Julia invocations used Julia 1.13.2, four Julia threads, one OpenBLAS thread, an isolated temporary directory, a writable shared depot with the default depots appended, and timeout 3600. Exactly three Julia processes were started sequentially. In the commands below, SHARED_DEPOT denotes the coordinator-provided depot; directory values are parameterized to avoid machine paths.

git -C src status --short
git -C src rev-parse HEAD
git -C src fetch origin '+refs/pull/112/head:refs/remotes/pr/112' main
git -C src checkout --detach pr/112
git -C src rev-parse HEAD origin/main
git -C src merge-base origin/main HEAD
git -C src diff origin/main...HEAD --stat
git -C src diff origin/main...HEAD
git -C src diff --check origin/main...HEAD
git -C src log -1 --no-merges --format=%B
git -C src worktree add --detach ../base 9d980e62f01e0438beaafafd1b7d6ce6ccd96579
gh pr view 112 --repo SciML/LineSearch.jl --json number,url,state,isDraft,headRefOid,baseRefName,baseRefOid
gh pr view 112 --repo SciML/LineSearch.jl --json title,body,headRefOid,baseRefOid,statusCheckRollup
gh issue view 109 --repo SciML/LineSearch.jl --json title,body,state
gh pr checks 112 --repo SciML/LineSearch.jl
gh run list --repo SciML/LineSearch.jl --branch main --event push --limit 5 --json databaseId,headSha,status,conclusion,url
XDG_CACHE_HOME="$PWD/tmp/cache" gh run view 39050722081 --repo SciML/LineSearch.jl --job 117462518157 --log
JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$SHARED_DEPOT:" JULIA_PKG_PRECOMPILE_AUTO=0 XDG_CACHE_HOME="$PWD/tmp/cache" timeout 3600 julia +1.13.2 --startup-file=no run_head.jl
JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$SHARED_DEPOT:" JULIA_PKG_PRECOMPILE_AUTO=0 XDG_CACHE_HOME="$PWD/tmp/cache" timeout 3600 julia +1.13.2 --startup-file=no run_base.jl
JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$SHARED_DEPOT:" JULIA_PKG_PRECOMPILE_AUTO=0 XDG_CACHE_HOME="$PWD/tmp/cache" timeout 3600 julia +1.13.2 --startup-file=no --project=env/head probe.jl

Git, metadata and final CI-log reads exited 0; diff checking emitted no diagnostics. The first CI-log attempt could not write the default cache; redirecting the cache into the writable temporary directory allowed inspection. The head matches TARGET.md. The merge-base and GitHub-reported base are 9d980e6; fetched main has since advanced to a492aa9.

The head and base drivers each activate a separate scratch environment, develop the respective checkout, add Reactant 0.2.294, ReactantCore, CommonSolve and SciMLBase 3.58.0, then include the unchanged head file test/reactant/reactant_tests.jl inside one enclosing testset. Their output tails are:

PR head Reactant regressions   | Pass 66 | Total 66 | 6m07.9s | exit 0
Merge-base Reactant regressions | Pass 30 | Error 14 | Total 44 | 54.1s | exit 1
Scalar indexing is disallowed.
Invocation of setindex!(::TracedRArray, v, ::Union{Int, TracedRNumber{Int}}) resulted in scalar indexing of a GPU array.

Thus the added tests demonstrate failing-before/passing-after for the compiled-support fix. The base fails during compiled cache/history handling before it can isolate the later NaN-interpolation or return-code fixes individually.

The third invocation passed all 30 independent assertions (exit 0, 31.8s). For residual f(u)=u at u=1, directly evaluating the quadratic merit and interpolation gives accepted steps -0.5, +0.5, -0.1, +0.1, +1 and -1 for directions +2, -2, +4, -4, -0.25 and +0.25 respectively. Both ordinary and compiled execution matched these independently derived values. Zero permitted iterations returned step 2 / Failure. For M=3, callbacks with residuals 2, 3, 4, 5 yielded history [9,16,25] and count 4; reinit! followed by residual 6 yielded [9,16,36] and count 1, preserving the existing reinitialization contract. Concise output:

LINEAR d=2.0 analytic=-0.5 host=-0.5 compiled=-0.5
LINEAR d=-2.0 analytic=0.5 host=0.5 compiled=0.5
LINEAR d=4.0 analytic=-0.1 host=-0.1 compiled=-0.1
LINEAR d=-4.0 analytic=0.1 host=0.1 compiled=0.1
LINEAR d=-0.25 analytic=1.0 host=1.0 compiled=1.0
LINEAR d=0.25 analytic=-1.0 host=-1.0 compiled=-1.0
HISTORY before=[9.0, 16.0, 25.0] count=4 after reinit/callback=[9.0, 16.0, 36.0] count=1
independent analytical linear residual and history probe | Pass 30 | Total 30 | 31.8s

Inspected Reactant CI job: Julia 1.13.2, 66/66 assertions pass. The job checks the synthetic PR merge containing the exact reviewed head. All PR test groups, downgrade tests, documentation, formatting, spelling and benchmarks report success. Recent default-branch runs also report success, including run 41052896137; there were no failing validation jobs requiring failure-log comparison.

What I did not verify

No GPU/TPU execution, differentiation through the compiled search, MPI, other platforms or Julia versions, minimum Reactant/ReactantCore pairing, full local package suite, or local Enzyme suite. The compiled integration test uses a DF-SANE-style caller rather than an actual NonlinearSolve.DFSane invocation; the issue's claimed 11-step integration result was not verified. The added test instead asserts and demonstrates convergence in 12 iterations. No isolated failing-before run of the NaN guard or SciMLBase return-code floor was performed. Reactant CPU tracing itself was exercised locally and in CI, satisfying G2; analytical convergence and linear-residual steps supply G1 evidence, and the carried-history solver and exact wraparound/reinitialization probe supply G3 evidence.

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

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review November 2, 2026 01:56
@ChrisRackauckas
ChrisRackauckas merged commit 4537f43 into SciML:main Nov 2, 2026
15 checks passed
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.

Make RobustNonMonotoneLineSearch traceable under Reactant.@jit

2 participants