Repository navigation
Merge JumpProblem kwargs once when init-ing with an SDE/RODE algorithm - #4707
Merged
ChrisRackauckas merged 1 commit intoOct 3, 2026
Merged
ChrisRackauckas merged 1 commit into
ChrisRackauckas merged 1 commit into
Conversation
`init(jprob::JumpProblem, EM())` merged `jprob.kwargs` twice: once in
DiffEqBase's `init_call`, and again in JumpProcesses'
`JumpProcessesOrdinaryDiffEqCoreExt.__init(::JumpProblem,
::Union{StochasticDiffEqAlgorithm, StochasticDiffEqRODEAlgorithm})`, which
won dispatch over StochasticDiffEqCore's `__init`. A callback stored in the
JumpProblem therefore fired twice. StochasticDiffEqCore now defines
`__init(::JumpProblem, ::StochasticDiffEqAlgorithm)` and
`__init(::JumpProblem, ::StochasticDiffEqRODEAlgorithm)`, which are more
specific than the extension method and go straight to `_sde_init`, the same
path `solve` uses.
Fixes SciML#4439
Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude <[email protected]>
Agent-Harness: Claude Code 2.1.285
Agent-Model: claude-opus-5-5
Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/jobs/fix-OrdinaryDiffEq.jl-4439/log.txt on amdci2.julia.csail.mit.edu
ChrisRackauckas
marked this pull request as ready for review
October 3, 2026 11:51
This was referenced Oct 10, 2026
This was referenced Oct 13, 2026
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>
ChrisRackauckas
pushed a commit
that referenced
this pull request
Oct 25, 2026
…#4914) * Narrow StochasticDiffEqCore's union `__init` to RODE problems A `JumpProblem` with an SDE or RODE algorithm already dispatches to the per-algorithm `__init` methods added in #4707, which are more specific than the union method, so no call changes method. Under JumpProcesses 10 the union method is ambiguous, at signature level, with JumpProcesses' `__init(::JumpProblem, ...)` extension method, whose algorithm union now also covers ODE and DAE algorithms. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Allow JumpProcesses 10 in StochasticDiffEqCore, Implicit, and Leaping Widen the JumpProcesses compat to "9.26.0, 10" and bump the patch versions (Core 2.2.5, Implicit 2.2.2, Leaping 2.1.1). No source changes are needed: Core's only JumpProcesses calls, `resetted_jump_problem` and `reset_jump_problem!`, are kept by JumpProcesses 10 for StochasticDiffEq compatibility (as a `deepcopy` and a no-op, since jumps now draw from the integrator's RNG), and JumpProcesses 9 behavior is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
init(jprob, EM())on aJumpProblemthat wraps anSDEProblemmergedjprob.kwargstwice, so a callback stored in theJumpProblemfired twice. The first merge happens in DiffEqBase'sinit_call. The second happens because JumpProcesses'JumpProcessesOrdinaryDiffEqCoreExt.__init(::JumpProblem, ::Union{StochasticDiffEqAlgorithm, StochasticDiffEqRODEAlgorithm})won dispatch and merged again. StochasticDiffEqCore now defines__init(::JumpProblem, ::StochasticDiffEqAlgorithm)and__init(::JumpProblem, ::StochasticDiffEqRODEAlgorithm), which are more specific than that method and call_sde_initdirectly. That is the pathsolvealready takes. They also cover the TauLeaping-style jump algorithms that the method this replaces handled.The
solvepath reported in the issue already fires once on master: #4409 made__solve(::JumpProblem, ...)call_sde_initdirectly (StochasticDiffEqCore 2.2.1; the issue was filed against 2.2.0). Reproduced on master with the issue's script:solve(...)givesfire_count[] = 1,init(...) |> solve!givesfire_count[] = 2. The regression test extends the existingcallback from JumpProblem.kwargs fires exactly oncetestset to theinitpath.Failing before (fix stashed)
Passing after
Test groups run locally (Julia 1.12)
GROUP=Interface1inlib/StochasticDiffEq(contains the jump kwarg, rng/integratorinitand tstops tests):Testing StochasticDiffEq tests passedGROUP=Interface2inlib/StochasticDiffEq(containstau_leaping.jl, whichinits aJumpProblemwithTauLeaping):GROUP=QAinlib/StochasticDiffEqCore(Aqua incl. method ambiguities, JET):QA (Aqua and JET) | 21 21andTesting StochasticDiffEqCore tests passedtyposon both changed files: clean.Not verified
multithreaded_jump_test.jl), Julia LTS/pre, and downstream (ModelingToolkitBase'sSDEs + jumps with symbolic tstopstest from the issue).__init(::JumpProblem, ::AbstractDEAlgorithm), so behaviour is the same.Push back on
initwith an SDE/RODE algorithm now goes through_sde_initinstead of JumpProcesses'__jump_init, soinitandsolveshare one path. This deliberately overrides the JumpProcesses extension method by being more specific. The cleaner long-term fix may be to delete thoseStochasticDiffEqAlgorithm/StochasticDiffEqRODEAlgorithmmethods fromJumpProcessesOrdinaryDiffEqCoreExt. That's a JumpProcesses change and isn't part of this PR. The ODE methods in that extension likely double-merge oninitthe same way (not checked here).Fixes #4439
Please ignore this draft until reviewed by @ChrisRackauckas.
Risk assessment
pending independent review
🤖 Generated with Claude Code 2.1.285 (model: claude-opus-5-5), transcript /home/crackauc/sandbox/goals/issue-backlog/jobs/fix-OrdinaryDiffEq.jl-4439/log.txt on amdci2.julia.csail.mit.edu
Risk assessment
init(notsolve) on aJumpProblemwith a StochasticDiffEq SDE/RODE algorithm, including the TauLeaping-styleStochasticDiffEqJumpAlgorithm/StochasticDiffEqJumpAdaptiveAlgorithm. Both are subtypes ofStochasticDiffEqAlgorithminOrdinaryDiffEqCore/src/algorithms.jl, so the removed__initmethod is fully replaced. Downstream users of that path include MTK/Catalyst jump-diffusion code that uses the integrator interface.solveand ODE-algorithm jump paths are unchanged.e0b5c08: 166 pass, 4 fail, 1 skipping (the sublibrary-ci matrix template row). The four failures areSciMLSensitivity.jl/Core1/1 / Downstream Tests - Core1,downgrade-sublibraries / test (lib/DiffEqBase),downgrade-sublibraries / test (lib/OrdinaryDiffEqDifferentiation)andtests / GPU (julia 1, self-hosted Linux X64 gpu). All four also fail on the base commit7393799and on the two master commits before it (14f664a,cc57721), so they are pre-existing, not regressions. Every relevant suite passes on head: StochasticDiffEq Interface1/2/3 on Julia 1, lts and pre; Multithreaded; all convergence groups; QA; StaticAnalysis; StochasticDiffEqCore Core on 1/lts/pre plus QA, so Aqua found no new ambiguities; StochasticDiffEqLeaping; the downgrade jobs for every StochasticDiffEq* package; and the MTK downstream groups. No tests were weakened. One assertion was added, and the description shows it failing before the fix (2 == 1) and passing after.initthrough the same_sde_initpathsolvealready uses (since Fix TauLeaping JumpProblem initialization #4409), the new methods are strictly more specific than the JumpProcesses extension method they override, and CI shows no regressions.initpath, each of which brings it in line withsolve:CallbackSet(callback, jump_callback)replaces JumpProcesses'CallbackSet(jump_callback, callback).seednow seeds the SDE noise as well; before,__jump_initswallowed it. The jump RNG is also reseeded on everyinit, even without aseed.alias_jumpkwarg is no longer honored on this path; thealias = SDEAliasSpecifier(alias_jumps=…)option is used instead.JumpProcessesOrdinaryDiffEqCoreExt. The description discloses this. It uses no new non-public internals;_sde_initbelongs to this package, andJumpProcesses.resetted_jump_problem/reset_jump_problem!were already called. Technically it is type piracy, since neitherJumpProblemnorStochasticDiffEqAlgorithmis owned by StochasticDiffEqCore, but the method it replaces did the same.Union{AbstractRODEProblem, JumpProblem}__initmethod can no longer be reached forJumpProblem.🤖 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 Claude Code 2.1.285 (Mac) fleet-master head, model claude-opus-5-5[1m]
Conversation: local session 3c311569-dda6-4687-bc9f-65febb212c33 (~/.claude/projects/-Users-chrisrackauckas-sandbox-master/3c311569-dda6-4687-bc9f-65febb212c33.jsonl)