Repository navigation
Make RobustNonMonotoneLineSearch traceable under Reactant.@jit - #112
ChrisRackauckas merged 12 commits into
Conversation
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
Independent review (Devin CLI 3000.11.3, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium): CHANGES, risk medium. Full reviewVERDICT: CHANGES Reviewed head 1eb89a7 (#112, issue #109). Reviewer: Devin CLI, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium. Risk is medium because Blocking findings
Non-blocking findings
What I ran
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 |
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)
Independent review (Codex CLI 0.166.0 / gpt-6.1-sol), session 01a19712-d0ac-7792-a30c-629778d59d3f, reviewed head 99464aa
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 findingsNone. Non-blocking findingsNone. What I ranAll 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.jlGit, 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: 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: 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 verifyNo 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 |
Fixes #109
Please ignore this draft until reviewed by @ChrisRackauckas.
RobustNonMonotoneLineSearchsupports 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 supportssuccessful_retcodeinside compiled callers. Compiled interpolation explicitly propagates NaN ratios so invalid trial residuals produce the same failure as the host.The host
LineSearchSolutiontype and host search loop are unchanged. Compiled calls return an internalTracedLineSearchSolutionexposingstep_sizeandretcode, 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
SciMLBase.successful_retcode(sol.retcode)inside@jitand after return. The compiled DF-SANE loop stops when the line search fails.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.Local verification
All logs and scratch environments are under
<job>/scratch. Writable depot and temporary/cache directories are job-local;~/.juliais a read fallback. Julia defaults were not changed.Failing before / passing after
The
scratch/beforesource 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.jldevelops that snapshot, adds Reactant 0.2.291 plus the requested exact SciMLBase version, and pins SciMLBase;run_reactant.jlincludes 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:
SciMLBase 3.57.0, exit 1: all three return-code consumers throw the same error:
SciMLBase 3.58.0 on the identical unguarded snapshot, exit 1: the return-code tests and DF-SANE pass; only the NaN regression fails:
After developing the fixed checkout into a separate environment with the same Reactant 0.2.291 / SciMLBase 3.58.0 pins:
Exit 0:
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.
All exited 0. Actual output tails:
Downgrade reproduction
Exit 0. This copies the earlier report's
downgrade.jl, runs it on Julia 1.10.12 with the stdlib skip list,mode=deps, version1, andno_promote=Mooncake, then runsPkg.build(verbose=true)and:Resolved floors: SciMLBase 3.58.0, ReactantCore 0.1.21, SciMLTesting 2.4.0. Actual tail:
Formatting, spelling, docs
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:Exit 0. The first complete build encountered HTTP 429 on the existing ColPrac link; the unchanged retry passed with link checking enabled:
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_failureon 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.DFSaneinvocation 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
LineSearchSolutiondoes 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
LineSearchSolutiontype are unchanged.🤖 Generated with Codex CLI 0.163.0 (model: gpt-6.1-sol); local job 112-codex, transcript: /log.txt