Repository navigation
Gate initialization discrete saves on save_discretes - #4753
Merged
ChrisRackauckas merged 5 commits intoOct 4, 2026
Merged
ChrisRackauckas merged 5 commits into
ChrisRackauckas merged 5 commits into
Conversation
Event-time discrete saves already respect save_discretes; the init path did not, so save_discretes=false still recorded the initial discrete value. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/OrdinaryDiffEq.jl/jobs/4742-cursor/log.txt on amdci2.julia.csail.mit.edu
Asserts that a never-firing callback with saved_clock_partitions leaves discrete storage empty when save_discretes=false, while still saving once at t0 when true. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/OrdinaryDiffEq.jl/jobs/4742-cursor/log.txt on amdci2.julia.csail.mit.edu
DelayDiffEq calls save_discretes_if_enabled! again after initialize_callbacks!; without the same guard, DDE solves would still save discretes at start when save_discretes=false. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/OrdinaryDiffEq.jl/jobs/4742-cursor/log.txt on amdci2.julia.csail.mit.edu
save_final_discretes! at the endpoint path ignored opts.save_discretes; apply the same DiffEqBase-style guard, Runic-format the SymbolCache call, and assert finalize-only saves respect save_discretes=false. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/OrdinaryDiffEq.jl/jobs/4742-cursor/log.txt on amdci2.julia.csail.mit.edu
Cover MethodOfSteps(Tsit5()) solve and reinit! paths so the post-init DelayDiffEq discrete-save gate is exercised. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Cursor Agent <[email protected]> Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/OrdinaryDiffEq.jl/jobs/4742-cursor/log.txt on amdci2.julia.csail.mit.edu
ChrisRackauckas
marked this pull request as ready for review
October 4, 2026 14:23
ChrisRackauckas
referenced
this pull request
Oct 13, 2026
…inaryDiffEqBDF, OrdinaryDiffEqExplicitRK, OrdinaryDiffEqFIRK, OrdinaryDiffEqFeagin, OrdinaryDiffEqHighOrderRK, OrdinaryDiffEqPDIRK, OrdinaryDiffEqRKN, OrdinaryDiffEqSDIRK, StochasticDiffEqHighOrder, StochasticDiffEqLowOrder, and StochasticDiffEqMilstein for release (#4871) Agent-Harness: Devin CLI 3000.11.3 Agent-Model: Fusion (Claude Opus 5.5 Medium + SWE-2 Medium) Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/flash-hour.json Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ignore until reviewed by @ChrisRackauckas.
initialize_callbacks!andfinalize_endpoint!called SciMLBase discrete-save helpers without checkingintegrator.opts.save_discretes, sosave_discretes=falsestill recorded discretes at init and (when the endpoint-save path runs) at finalize. Event-time saves in DiffEqBase already use!isdefined(integrator.opts, :save_discretes) || integrator.opts.save_discretes; this PR applies the same guard on those ODE paths and on DelayDiffEq's post-init discrete save. Defaultsave_discretes=trueis unchanged.Verification
Runic (Julia formatter, not the unrelated
runicbinary):Init gate (OrdinaryDiffEqCore)
Fail-before (src init gate reverted):
Pass-after:
save_discretes initialization | 4 Pass(init-only subset before finalize test was added).Finalize gate (OrdinaryDiffEqCore)
Fail-before (
finalize_endpoint!gate reverted;save_everystep=falseso endpoint path runs):Pass-after (narrowed):
save_discretes initialization | 8 Pass(init + finalize).DelayDiffEq post-init gate
Fail-before (DelayDiffEq src gate reverted; Core init gate kept):
Pass-after (narrowed):
save_discretes | 6 Pass.Full suites
Not verified
SymbolCachestand-in).save_discretes_if_enabled!/save_final_discretes!.Reviewer pushback
save_discretes_if_enabled!should be removed rather than gated.solution_endpoint_match_cur_integrator!appends the endpoint (save_everystep=falsein the test); dense every-step solves may not hit that path.Fixes #4742
Risk assessment
save_discretes=falseat init, DelayDiffEq post-init, and endpoint finalize; defaulttrueunchanged.GROUP=Coreand DelayDiffEqGROUP=Integratorspassed.🤖 Generated with Cursor Agent CLI (model: auto)
Transcript: /home/crackauc/sandbox/goals/issue-backlog/ibd/OrdinaryDiffEq.jl/jobs/4742-cursor/log.txt on amdci2.julia.csail.mit.edu
Risk assessment
save_discretes=falseand a callback that hassaved_clock_partitions. In practice that means ModelingToolkit models with@discretesor discrete events. Those solves no longer save discretes at initialization, at DelayDiffEq's post-init save, or at the endpoint infinalize_endpoint!. Code that relied on the old behaviour, wheresol.ps[h]held exactly one value ([t0], or the endpoint) even withsave_discretes=false, will now get an empty timeseries. This is the documented intent of the flag and fixessave_discretes = falsestill saves the discretes at initialization #4742, so it is a patch-level bug fix, not a SemVer break. With the defaultsave_discretes=true, the code path is unchanged. The fix lives in the OrdinaryDiffEq monorepo only. Other integrators that callSciMLBase.save_discretes_if_enabled!directly don't get it, which the description discloses.5d0eaae9, 261 checks pass, 1 is skipped and 8 fail. I compared every failure against master and none is a regression:SciMLSensitivity.jl/Core1/1 / Downstream Tests - Core1: the same 2 errors (Mooncake with MooncakeAdjointatconcrete_solve_derivatives.jl:451, andComplex Adjoints) with an identical count (231 passed, 2 errored, 6 broken) on master head4a5c0e71. Also fails onbd6cfb3c,e7068884(the base) and75bc9dfc. Pre-existing.downgrade-sublibraries / test (lib/DiffEqBase)anddowngrade-sublibraries / test (lib/OrdinaryDiffEqDifferentiation): both fail on4a5c0e71,bd6cfb3c,e7068884and75bc9dfc. Pre-existing.tests / GPU (julia 1, self-hosted Linux X64 gpu): fails on4a5c0e71,e7068884and75bc9dfc. Pre-existing.sublibrary-cijobs fail with the same error and count on master75bc9dfc. Later master commits only run the touched sublibraries, so they have no newer runs of these jobs. Pre-existing:lib/GlobalDiffEqCore:companion_tests.jl:49errors.lib/OrdinaryDiffEqDifferentiationCore:ScalarOperator mass matrixfails withMethodError: diag(::ScalarOperator).lib/OrdinaryDiffEqNonlinearSolveCore:Newton Testsfails withLineSearchException.lib/OrdinaryDiffEqRosenbrock [QA]:Rosenbrock32 perform_step! inferenceerrors atinference_tests.jl:58.tests / ModelingToolkitjobs on Julia 1, lts and pre.!isdefined(opts, :save_discretes) || opts.save_discretesguard that DiffEqBase already applies to event-time saves; the default path is untouched; no tests were weakened. It adds 2 new testsets (Core: init and finalize; DDE: solve andreinit!), and the description shows each failing before the fix and passing after.save_discretes_if_enabled!andsave_final_discretes!. Both calls predate this PR and are on the ExplicitImports allowlist inlib/OrdinaryDiffEqCore/test/qa/qa.jl, so nothing new is introduced.sol.ps[h]changes from one value to empty undersave_discretes=false. Users who depended on that will see the difference.SymbolCachestand-in. The description discloses this.🤖 Risk assessment posted by an AI agent (fleet master) — harness: Devin CLI (Mac) / fusion-claude-opus-5-5-high-sidekick-swe-2-medium; dispatched by Devin CLI 3000.11.3 (Mac) fleet-master caretaker, model Fusion (claude-opus-5-5 medium + swe-2 medium)
Conversation: local transcript ~/.local/share/devin/cli/transcripts/speckle-whale.json (Chris's Mac)