Skip to content

Set ForwardDiff event-time partials by the implicit function theorem - #4697

Open
ChrisRackauckas-Claude wants to merge 6 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix-4388-dual-find-root
Open

ChrisRackauckas-Claude wants to merge 6 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix-4388-dual-find-root

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Please ignore until reviewed by @ChrisRackauckas.

DiffEqBase.find_root ran ModAB at abstol = reltol = 0 directly on Dual endpoints, so the partials of an event time came out of the bracketing iteration rather than the implicit function theorem: the value was exact but dT/dq was off by ~1e-9 in the root finder and ~1e-5 once amplified through a Vern9 interpolant (reported by @andreapasquale94, root-caused to find_root by @singhharsh1708 in the issue). The ForwardDiff extension now adds a find_root method for Dual{T,V<:AbstractFloat,N} brackets that locates the root on the primal values (same ModAB call, so the Left/RightRootFind bracket side is decided exactly as before) and sets the partials to -(∂g/∂p)/(∂g/∂t) at the root.

Details a reviewer should check:

  • ∂g/∂t is obtained by re-evaluating the condition with one partial of t seeded (difference of partials, rescaled once to avoid cancellation), not by nesting a new tag, because in-place callbacks interpolate into buffers of the exact Dual{T,V,N} type.
  • get_condition returns the stored u/uprev when t equals integrator.t/tprev, which drops the t dependence. If the primal root equals an original bracket endpoint, the derivative is evaluated at the other side of the final one-ulp bracket instead; if both sides are original endpoints, or ∂g/∂t is zero/non-finite, or the condition does not return a Dual{T} with N partials, it falls back to the previous generic method.
  • Nested Duals (V <: Dual) are not covered and still use the generic method.

Tests

  • lib/DiffEqBase/test/callbacks.jl (Core): find_root on sin(t) - q, t^3 - q, exp(t) - q - 1 with a 2-partial q, both rootfind sides; checks the value equals the primal ModAB root and the partials match the analytic dt/dq to rtol = 16eps.
  • lib/DiffEqBase/test/downstream/forwarddiff_event_time.jl (Downstream2): the issue MWE (u' = 1, terminate at u = q, dT/dq = 1) for Tsit5/Vern9, q ∈ (3.0, 1.7, 5.3), oop and iip, with rtol = 1e-10; and u' = p u, terminate at u = 2, dT/dp = -log(2)/p^2, rtol = 1e-9. The 1e-10 bound comes from the discrete event time having dT/dq = 1/û'(T) for the dense output û: a Float64 solve with the same settings gives 1/û'(T) - 1 = 1.6e-12 for Vern9 at q = 3.0, and the fixed ForwardDiff result is 1.53e-12 there.

Fails before (master src + new tests; lib/DiffEqBase from a clean master worktree)

DiffEqBase at .../scratch/master-wt/lib/DiffEqBase
   Evaluated: 1.0910894523596264 ≈ 1.0910894511799618 (rtol=3.552713678800501e-15)
   Evaluated: 0.6140052377107055 ≈ 0.6140052497733979 (rtol=3.552713678800501e-15)
   Evaluated: 0.714285711244661 ≈ 0.7142857142857143 (rtol=3.552713678800501e-15)
   ...
Test Summary:               | Pass  Fail  Total  Time
core                        |   12    12     24  4.8s

ForwardDiff event time through ContinuousCallback: Test Failed
   Evaluated: 1.000003616028192 ≈ 1 (rtol=1.0e-10)
   Evaluated: 1.000000109275194 ≈ 1 (rtol=1.0e-10)
   ...
   Evaluated: -1.414586769348068 ≈ -1.4145860827753987 (rtol=1.0e-9)
Test Summary:                                     | Pass  Fail  Total     Time
ForwardDiff event time through ContinuousCallback |   15    13     28  3m10.7s

Passes after

DiffEqBase at .../repo/lib/DiffEqBase
Test Summary: | Pass  Total  Time
core          |   24     24  2.6s
Test Summary:                                     | Pass  Total     Time
ForwardDiff event time through ContinuousCallback |   28     28  3m47.9s

Verification (Julia 1.12.7, local)

  • GROUP=Core julia --project -e 'using Pkg; Pkg.test()' in lib/DiffEqBase: Callbacks | 59 59, all testsets pass, Testing DiffEqBase tests passed.
  • GROUP=QA in lib/DiffEqBase: Aqua | 9 9, exit 0.
  • GROUP=Downstream2 in lib/DiffEqBase: ForwardDiff Event Time | 28 28, Community Callback Tests | 16 16, all pass, exit 0.
  • Root package GROUP=Integrators_I: all pass (Events Tests 58, Alg Events Tests 177, Event Detection Tests 23, Event Repetition Detection Tests 6, Multi-VCC Mask Tests 28, ...), Testing OrdinaryDiffEq tests passed.
  • Root package GROUP=Integrators_II: all pass (Reverse Directioned Event Tests 170, Cache Tests 214 + 4 broken, ...), exit 0.
  • Root package GROUP=AD: AD Tests 28299, Autodiff Events Tests 5 pass + 1 pre-existing @test_broken, Discrete Adjoint Tests 12, exit 0.
  • Runic --check and typos on the four changed files: clean.

Not verified

  • Julia LTS / pre, GPU, and the other root test groups (InterfaceI–V, Regression, Downstream, ModelingToolkit).
  • The ModelingToolkit and Sundials groups of DiffEqBase, and VectorContinuousCallback with ForwardDiff specifically (it shares find_root, but no new test targets it).
  • Nested Duals (Hessians of event times): unchanged, still the generic path.

Fixes #4388

Risk assessment

  • Risk: medium
  • Blast radius: every ContinuousCallback/VectorContinuousCallback root find where t is a ForwardDiff.Dual with a float value type, i.e. ForwardDiff through any solve with a continuous callback (tspan is promoted to Dual in that case). Event time values/bracket sides are computed by the same primal ModAB call; only the partials change. No public API change; the new method lives in DiffEqBaseForwardDiffExt. Per event it costs one primal ModAB solve plus three condition evaluations (a second primal solve when the root lands on an original bracket endpoint).
  • Evidence: fail-before/pass-after above; DiffEqBase Core, QA, Downstream2 and root Integrators_I, Integrators_II, AD pass locally.
  • Independent review: Grok Build (grok-4.7) rated it medium, high confidence: VERDICT MERGE, no blocking findings. New tests fail on master (callbacks.jl Dual partials 12/24, downstream 15/28) and pass on the PR (24/24, 28/28); partials match analytic dt/dq to ≤3.6e-16 on find_root cases and ≤9.5e-12 on Vern9 ODE events; Left/Right sides, endpoint roots, backward tspan, VectorContinuousCallback and in-place callbacks verified; 1e-10 tolerance justified by Vern9 dense-output error. Non-blocking: a multiple root with all-zero ∂g partials still returns a zero partial (same as master); interaction with open PR Locate continuous-callback events with NewtonBisection when the condition has a derivative #4624 (4-arg find_root) not tested.
  • Merge: needs human review — numerics change.

🤖 Generated with Claude Code (model: claude-opus-5-5[1m])

https://claude.ai/code/session_01AXwyJDRaMKgnYMG9M1Ut49

🤖 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 958995c)

Handle the review's zero-partial ForwardDiff.Dual finding: after locating the primal root, return it in the bracket's Dual type when N == 0. The regression checks both integration directions and both root sides, including the analytic root, bracket-side equality, result type, and empty partials. The fix adds one implementation line and 14 test lines. Current master was merged normally, preserving the existing commits and including upstream Enzyme integration compatibility changes.

Verification

Julia 1.12.7; four Julia threads, one BLAS thread, automatic precompilation disabled, at most three concurrent Julia processes. Full Core group, before the guard on the original PR head and after the guard with current master merged:

GROUP=Core timeout 7200 julia +1.12.7 --compiled-modules=existing --project=lib/DiffEqBase -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'

Before, exit 1:

  ArgumentError: reducing over an empty collection is not allowed; consider supplying `init` to the reducer
Callbacks                               |   59      1     60  24.5s
  Dual rootfinding without partials     |           1      1   2.0s

After, exit 0; all 16 new assertions pass:

Callbacks     |   75     75  20.9s
Testing DiffEqBase tests passed

Original event-time integration file, in an isolated environment with local sources for OrdinaryDiffEq, DiffEqBase, and their in-repository dependencies plus ForwardDiff (EVENT_ENV identifies that environment):

timeout 7200 julia +1.12.7 --compiled-modules=existing --project="$EVENT_ENV" -e 'using DiffEqBase, ForwardDiff, OrdinaryDiffEq; @show pathof(DiffEqBase); include("lib/DiffEqBase/test/downstream/forwarddiff_event_time.jl")'

Exit 0; the printed source location confirmed this checkout:

Test Summary:                                     | Pass  Total     Time
ForwardDiff event time through ContinuousCallback |   28     28  1m11.3s

Formatting and spelling, exit 0 with no output:

timeout 3600 julia +1.12.7 --project=@runic -m Runic --inplace lib/DiffEqBase/ext/DiffEqBaseForwardDiffExt.jl lib/DiffEqBase/test/callbacks.jl
git diff upstream/master --name-only -z | xargs -0 typos
git diff --check

QA was run without suppressions:

GROUP=QA timeout 7200 julia +1.12.7 --compiled-modules=existing --project=lib/DiffEqBase -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'

Exit 1:

QA                                             |   18      1     19  1m46.1s
StaleImportsException
Module `DiffEqBase` has stale (unused) explicit imports for:
  AbstractIntegralProblem, AbstractLinearProblem,
  AbstractNonlinearProblem, AbstractSteadyStateProblem

The same four imports fail the same QA check with 18 passes and one error in the default-branch push run at e335541198. A separate investigator also reproduced the identical 18-pass/one-error result locally on a clean archive of current master at 6a6d63e642, with Julia 1.12.7 and the same dependency manifest. This is a baseline failure; the separate baseline investigation does not change this PR's scope.

Original failing Core4 check

Independently compared the actual failed PR log with the master push run at d727918100: both use Julia 1.13.2, Enzyme 0.13.216, EnzymeCore 0.8.23, GPUCompiler 1.23.0, LLVM 9.13.2, Enzyme_jll 0.0.303+0, SciMLSensitivity 7.119.13, and OrdinaryDiffEqCore 4.19.0. Both report AssertionError: mi2 !== nothing in threadsfor_common at parallelrules.jl:233, reached from the threaded ensemble at ensembles.jl:19, with 15 passes, one error, and two broken tests. This matches the existing RecursiveArrayTools PR 685 baseline investigation; it was not repeated. Latest master Core4 passes, 16 passes and two broken tests, with Enzyme 0.13.217 on Julia 1.13.3. No test or dependency constraint was weakened in this PR.

CI was checked once after pushing: the PR head is 958995c36e, with 34 checks in progress and 46 queued. CI completion, full Downstream2/Core4 suites, other root-package groups, documentation, GPU paths, and other Julia versions were not verified locally.

Overall PR risk remains medium-high due to the event-time sensitivity implementation. This fix only handles zero-partial brackets. No independent review of this new head is claimed.

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__OrdinaryDiffEq.jl__4697 (no session URL)

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

Fix by Muse CLI Code muse-wonder-full-1.0 (head ee83eb1)

Merged current upstream master (6343f5a0b7) into this branch (clean merge, no conflicts; merge commit ee83eb1748). No code changes of my own: the PR diff against master is unchanged (the four DiffEqBase files).

Failure classification on the previous head (958995c36e), from rack ci compare --no-record against the default branch:

  • Pre-existing (identical failure on master): DiffEqBase QA (stale explicit imports, 18 passed / 1 errored), AD on Julia lts (autodiff_events.jl:117, ReverseDiff tape error), GPU, and SciMLSensitivity Core2 (same tape error).
  • TaylorDiff 0.3.5 load failure (TypeError: non-boolean (Symbolics.Num) in TaylorDiff precompilation): hit Documentation, the OrdinaryDiffEqTaylorSeries and OrdinaryDiffEqTaylorSeriesImplicit downgrade jobs, and ProbNumDiffEq downstream. Upstream commit 760d930622 ("Raise TaylorDiff compat floors to 0.3.6") fixes the compat floor; it is now merged into this branch.
  • ProbNumDiffEq downstream also reported 6 test failures (1719 passed) with no shared signature against the failing master job; the PR diff touches only the DiffEqBase ForwardDiff extension and its tests, so this needs CI on the new head to re-evaluate.

Validation (Julia 1.12.4, JULIA_NUM_THREADS=4)

GROUP=Core timeout 3600 julia --project=lib/DiffEqBase -e 'using Pkg; Pkg.test()'

Full Core group passes, ending with:

Test Summary:        | Pass  Total  Time
Despecialized-p Hook |   67     67  6.2s
     Testing DiffEqBase tests passed
timeout 1800 julia --project=lib/OrdinaryDiffEqTaylorSeries -e 'using Pkg; Pkg.instantiate(); using OrdinaryDiffEqTaylorSeries; println("TAYLOR_LOAD_OK")'

Exit 0, TAYLOR_LOAD_OK printed (OrdinaryDiffEqTaylorSeries precompiles and loads with the merged TaylorDiff 0.3.6 floor).

julia --project=@runic -m Runic --inplace lib/DiffEqBase/ext/DiffEqBaseForwardDiffExt.jl lib/DiffEqBase/test/callbacks.jl lib/DiffEqBase/test/downstream/forwarddiff_event_time.jl lib/DiffEqBase/test/runtests.jl
git diff upstream/master...HEAD --name-only -z | xargs -0 typos
git diff --check

All exit 0, no changes.

GROUP=QA timeout 1700 julia --compiled-modules=existing --project=lib/DiffEqBase -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'

Exit 1 with the pre-existing failure only (an earlier plain run timed out in shared-depot precompilation-lock contention before running tests; the retry above completed):

Test Summary:                                  | Pass  Error  Total   Time
QA                                             |   18      1     19  51.3s
no_stale_explicit_imports: Error During Test
  StaleImportsException
  Module `DiffEqBase` has stale (unused) explicit imports for:
ERROR: LoadError: Some tests did not pass: 18 passed, 0 failed, 1 errored, 0 broken.

This matches the default-branch QA failure signature from rack ci compare (same test file location and 18-passed/1-errored summary), so it is pre-existing and unchanged by this merge.

Not verified locally: Documentation build, downgrade jobs, Downstream/Downstream2, AD, GPU, SciMLSensitivity and ProbNumDiffEq downstream suites, and other Julia versions. These rerun in CI on the new head; the QA, AD-lts, GPU and Core2 failures are pre-existing on master per the compare evidence above.

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


🤖 Posted by an AI agent — harness: Muse CLI Code · model: muse-wonder-full-1.0
Conversation: local fixer job SciML__OrdinaryDiffEq.jl__4697 (no session URL)

ChrisRackauckas and others added 2 commits September 30, 2026 07:51
`find_root` ran ModAB at zero tolerance directly on Dual endpoints, so the
partials of the returned root came out of the bracketing iteration rather
than the implicit function theorem and were only accurate to ~1e-9 (1e-5
through a Vern9 interpolant). The ForwardDiff extension now locates the root
on the primal values, which keeps the Left/RightRootFind bracket semantics,
and sets the partials to -(dg/dp)/(dg/dt) at the root.

Fixes SciML#4388

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Agent-Harness: Claude Code
Agent-Model: claude-opus-5-5[1m]
Agent-Session: https://claude.ai/code/session_01AXwyJDRaMKgnYMG9M1Ut49
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Devin <noreply@cognition.ai>
Agent-Harness: Devin CLI 3000.11.3 (conflict resolution), Claude Code 2.1.285 (orchestration)
Agent-Model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium
Agent-Session: local Claude session 3c311569-dda6-4687-bc9f-65febb212c33 (fleet master); Devin log /Users/chrisrackauckas/sandbox/master/fusion-fixes/SciML_OrdinaryDiffEq.jl-4697/log.txt
@ChrisRackauckas

Copy link
Copy Markdown
Member

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

Merged the default branch into this PR (clean merge, no conflicts; head 8f4ef4e) so CI runs on current master. Its earlier failures in SciMLSensitivity Core1 and the downgrade jobs were fixed on master after this PR's last CI run.


🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (merge), 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-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 01a19811-7faf-76f1-85b9-8541567dccb3, reviewed head c3a1364

  • Verdict: MERGE-WITH-ISSUES
  • Risk: medium-high (MH1: continuous-callback rootfinding now dispatches to a specialized ForwardDiff implementation, changing event-time sensitivities for Tsit5, Vern solvers, and other callers).
  • 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: The PR computes ForwardDiff event-time partials using the implicit function theorem after locating the primal root. Its analytic regressions fail on the base and pass on the head; one internal zero-partial Dual compatibility edge remains non-blocking.

Blast radius: DiffEqBase.find_root with homogeneous Dual brackets whose value type is AbstractFloat; scalar and vector continuous callbacks using these brackets. Ordinary floating-point brackets and nested Dual value types retain the generic implementation.

Evidence: Blind risk assessment sealed before author context. On Julia 1.13.2, the added root-partial tests pass 24/24 on the head versus 12 passes and 12 failures on the merge-base; the added downstream event-time file passes 28/28 on the head versus 15 passes and 13 failures on the merge-base. Independent reverse-time vector-callback and cubic-condition ODE probes pass. Relevant DiffEqBase CI is green; the one failed integration job has the identical failure on a recent completed master run.

Blocking findings

None.

Non-blocking findings

  1. [P3] Guard zero-partial Dual brackets before selecting a partial. At lib/DiffEqBase/ext/DiffEqBaseForwardDiffExt.jl:280, argmax throws on an empty partial tuple. Confirmed by running: with D = ForwardDiff.Dual{:empty,Float64,0} and f(t,p=nothing) = sin(t)-D(0.4), DiffEqBase.find_root(f,(D(0.0),D(2.0)),SciMLBase.LeftRootFind) returns Dual{:empty}(0.41151684606748806) on the base but throws ArgumentError: reducing over an empty collection is not allowed on the head. Preserve this internal helper's previous behavior by returning D(tv) or invoking the generic method when N == 0, and add the direct regression test. This is non-blocking because no regression through a supported public solve was demonstrated: the attempted empty-parameter ODE gradient already fails on the base in the existing norm calculation.

What I ran

Read-only repository and GitHub inspection:

gh pr view 4697 --repo SciML/OrdinaryDiffEq.jl --json number,url,state,isDraft,headRefOid,baseRefName,baseRefOid
git -C src status --short
git -C src rev-parse HEAD origin/master
git -C src fetch origin '+refs/pull/4697/head:refs/remotes/pr/4697' master
git -C src fetch origin '+refs/heads/master:refs/remotes/origin/master'
git -C src merge-base origin/master HEAD
git -C src diff --stat origin/master...HEAD
git -C src diff origin/master...HEAD
gh pr view 4697 --repo SciML/OrdinaryDiffEq.jl --json title,body,commits,statusCheckRollup
gh issue view 4388 --repo SciML/OrdinaryDiffEq.jl --json title,body
git -C src log -1 --format=%B d9cc8985e2418dbc732bae7c44c85be21dd76141
gh pr checks 4697 --repo SciML/OrdinaryDiffEq.jl
gh run list --repo SciML/OrdinaryDiffEq.jl --branch master --event push --limit 5 --json databaseId,conclusion,headSha,url,workflowName
gh run list --repo SciML/OrdinaryDiffEq.jl --branch master --event push --workflow IntegrationTest --status completed --limit 5 --json databaseId,conclusion,headSha,url,workflowName
XDG_CACHE_HOME="$PWD/tmp/cache" gh run view 38859045811 --repo SciML/OrdinaryDiffEq.jl --log-failed
XDG_CACHE_HOME="$PWD/tmp/cache" gh run view 41318549672 --repo SciML/OrdinaryDiffEq.jl --log-failed
git -C src archive 59ba40e4b5bbae713d8df7b792f6ea62f033ff78 | tar -x -C tmp

Repository inspection, fetch, and archive commands exited 0. The initial failed-log retrieval could not write the default cache; setting the writable cache directory above succeeded. GitHub reported the PR open and draft, with the target head unchanged. The reviewed base is the merge-base, also the baseRefOid returned by the PR metadata query. No upstream writes were made.

Exactly three Julia processes ran, serially, using Julia 1.13.2 on aarch64. The shared-depot value is represented below by $SHARED_DEPOT to omit machine paths. Temporary environments used explicit local package sources for OrdinaryDiffEq and its transitive in-repository dependencies, plus ForwardDiff. The first runner set Pkg.UPDATED_REGISTRY_THIS_SESSION[] = true and called Pkg.instantiate(; allow_autoprecomp=false); automatic precompilation was disabled. Both regression runners included the same head versions of lib/DiffEqBase/test/callbacks.jl and lib/DiffEqBase/test/downstream/forwarddiff_event_time.jl in separate modules, catching testset exceptions so both files ran.

JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$SHARED_DEPOT:" JULIA_PKG_PRECOMPILE_AUTO=0 timeout 3600 julia +1.13.2 --startup-file=no --compiled-modules=existing --project=env run_regressions.jl
JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$SHARED_DEPOT:" JULIA_PKG_PRECOMPILE_AUTO=0 timeout 3600 julia +1.13.2 --startup-file=no --compiled-modules=existing --project=env-base run_base.jl
JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$SHARED_DEPOT:" JULIA_PKG_PRECOMPILE_AUTO=0 timeout 3600 julia +1.13.2 --startup-file=no --compiled-modules=existing --project=env adversarial.jl

Head regression run: exit 0. Output:

Dual rootfinding partials | 24 24
ForwardDiff event time through ContinuousCallback | 28 28

Base regression run: exit 1, as expected. Package source paths printed by the runners confirmed loading the head checkout and the archived base, respectively. The base environment reused the dependency manifest with local source paths changed to the base archive; Pkg emitted a manifest-resolution warning. Output:

Dual rootfinding partials | 12 12 24
Evaluated: 1.0910894523596264 ≈ 1.0910894511799618 (rtol=3.552713678800501e-15)
ForwardDiff event time through ContinuousCallback | 15 13 28
Evaluated: 1.000003616028192 ≈ 1 (rtol=1.0e-10)
BASE_EMPTY_DUAL_ROOT=Dual{:empty}(0.41151684606748806)

The derivative oracles are analytic: inverse-function derivatives for the scalar roots, T=q for unit-speed motion, and T=log(2)/p for exponential growth. The exact primal-equality assertion supplements these independent references.

Adversarial run: exit 1, reporting four probe exceptions. One establishes the non-blocking zero-partial root regression above; one repeats the existing empty-gradient norm failure; two are reviewer harness constructor errors described below. The independently specified ODE probes passed:

CUBIC_EVENT_DERIVATIVE=1.0000000000000075 analytic_partial=1.0
REVERSE_VCC_TIME=7.299999999999983 GRADIENT=[-0.0, 1.000000000000039]
ADVERSARIAL_FAILURES=4

The reverse-time in-place VectorContinuousCallback probe integrates u'=1 backward from u(10)=10 and terminates at the first of thresholds [3.1,7.3], giving the independent reference T=7.3 and gradient [0,1]. These runs exercise the changed ForwardDiff path and satisfy G2; the added analytic regressions provide G1 evidence. The implementation introduces no new shared state requiring a G3 test.

CI inspection found 132 successful checks, three skipped checks, and one failure. DiffEqBase Core, Downstream, and Downstream2 succeeded. The failed SciMLSensitivity Core4 job reports AssertionError: mi2 !== nothing in its threaded ensemble test at test/Core4/ensembles.jl:19. A recent completed master IntegrationTest run reports the exact same assertion in the same test, with the same 15 passes, one error, and two broken tests. This failure is therefore not attributed to the PR.

What I did not verify

The direct repeated-root and extreme derivative-scaling probes did not reach the implementation: my probe code incorrectly called a fully parameterized Dual constructor with two scalar arguments instead of a Partials argument. I did not rerun them after exhausting the three-run allowance. The passing cubic-condition ODE probe does not establish general repeated-root behavior. The attempted public empty-parameter ODE gradient fails in the existing norm on both revisions, so the zero-partial finding is limited to direct root-helper compatibility. I did not run whole-package suites, additional solver families, GPU/MPI execution, other AD backends, nested-Dual Hessians, other Julia versions/platforms, allocation benchmarks, or full downstream suites locally; CI status is distinguished above from my own runs.

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

@ChrisRackauckas-Claude
ChrisRackauckas-Claude marked this pull request as ready for review November 2, 2026 02:07
ChrisRackauckas and others added 2 commits November 6, 2026 14:36
Bring in upstream Enzyme integration compatibility updates.

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__OrdinaryDiffEq.jl__4697 (no session URL)
Return the primal root in the bracket Dual type when there are no partials.
Test both root sides and integration directions.

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__OrdinaryDiffEq.jl__4697 (no session URL)
…d-root

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Muse <noreply@meta.com>
Agent-Harness: Muse CLI Code
Agent-Model: muse-wonder-full-1.0
Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4697 (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.

Inaccurate ForwardDiff event-time derivative through a terminating ContinuousCallback

2 participants