Skip to content

Fall back to the solver default when an integrator carries no tolerances - #5106

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix-affect-tolerance-ssa
Sep 10, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix-affect-tolerance-ssa

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

What changed and why

ModelingToolkitBase master is red: lib/ModelingToolkitBase InterfaceII fails on Julia 1, lts and pre with

JumpSystem Test: Error During Test
  LoadError: FieldError: type NamedTuple has no field `abstol`, available fields: `callback`
  [2] affect_tolerance @ lib/ModelingToolkitBase/src/systems/callbacks.jl:939

(master run https://github.com/SciML/ModelingToolkit.jl/actions/runs/34284400093, jumpsystem.jl:109).

affect_tolerance reads integ.opts.abstol / .reltol directly. The second commit of
#5080 dropped the hasproperty guards on the
premise that "every SciMLBase integrator carries .opts with abstol/reltol". JumpProcesses'
SSAIntegrator does not: it stores

opts = (callback = CallbackSet(callback),)

(JumpProcesses/src/SSA_stepper.jl:236) — a plain NamedTuple with no tolerances at all. Any
ImplicitAffect fired from an SSA solve therefore threw FieldError instead of running.

The fix returns nothing when the tolerance field is absent, which is what the rest of the
function already does for the "no usable tolerance" cases and is the pre-#5080 behaviour
(the nonlinear solver's own default). #5080's intent is untouched for every integrator that does
carry tolerances.

Verification

Julia 1.12.7, local checkout of master at 88d9ad9300.

Failing before the fix

The new jumpsystem.jl testset, run against the unmodified callbacks.jl (fix stashed):

Implicit affect on an SSA integrator: Error During Test at string:1
  Got exception outside of a @test
  FieldError: type NamedTuple has no field `abstol`, available fields: `callback`
  Stacktrace:
   [2] affect_tolerance @ lib/ModelingToolkitBase/src/systems/callbacks.jl:940 [inlined]
   ...
Test Summary:                        | Error  Total   Time
Implicit affect on an SSA integrator |     1      1  22.0s

The two new affect_tolerance cases in symbolic_events.jl, same unmodified source:

affect_tolerance on an SSA-shaped integrator: Error During Test
  Expression: affect_tolerance(ssa_opts, :abstol) === nothing
  FieldError: type NamedTuple has no field `abstol`, available fields: `callback`
affect_tolerance on an SSA-shaped integrator: Error During Test
  Expression: affect_tolerance(ssa_opts, :reltol) === nothing
  FieldError: type NamedTuple has no field `reltol`, available fields: `callback`
Test Summary:                                | Error  Total  Time
affect_tolerance on an SSA-shaped integrator |     2      2  1.6s

Passing after the fix

Test Summary:                        | Pass  Total   Time
Implicit affect on an SSA integrator |    3      3  28.4s

Test Summary:                                | Pass  Total  Time
affect_tolerance on an SSA-shaped integrator |    2      2  0.0s

Test groups

All three green, on the branch head:

# lib/ModelingToolkitBase, GROUP=InterfaceII  (the group that is red on master)
JumpSystem Test | 4207   4207  9m51.8s
3670.69 seconds
     Testing ModelingToolkitBase tests passed

# lib/ModelingToolkitBase, GROUP=InterfaceI
2448.19 seconds
     Testing ModelingToolkitBase tests passed

# repo root, GROUP=InterfaceI  (runs symbolic_events.jl with ModelingToolkit loaded)
Test Summary: | Pass  Broken  Total      Time
InterfaceI    | 1509       3   1512  46m49.5s
     Testing ModelingToolkit tests passed

Zero Error During Test / Test Failed lines in either MTKBase log. The 3 Broken in the root
group are pre-existing @test_brokens, untouched here.

Formatting / spelling

julia -m Runic --check lib/ModelingToolkitBase/src/systems/callbacks.jl \
    lib/ModelingToolkitBase/test/jumpsystem.jl lib/ModelingToolkitBase/test/symbolic_events.jl
# exit 0
typos <the same three files>
# exit 0

What I did not verify

  • Julia lts and pre — ran on 1.12.7 only.
  • QA (Aqua/JET), Downgrade, Downstream, GPU and docs jobs: not run. The MTKBase QA job is red
    on master for an unrelated reason (see below); affect_tolerance is unchanged in signature and
    gains only a hasproperty check, so it should not move the JET count, but I did not measure it.
  • Every other MTKBase test group (Core, Initialization, SymbolicIndexing, …) and the other
    root groups.

Note for reviewers

This PR should be ignored until reviewed by @ChrisRackauckas.

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

https://claude.ai/code/session_01FeJYXni9MkJhPFA9yxYvfn

`affect_tolerance` reads `integ.opts.abstol`/`.reltol` directly. SciML#5080 dropped the
`hasproperty` guards on the premise that "every SciMLBase integrator carries `.opts`
with `abstol`/`reltol`", but `JumpProcesses`' `SSAIntegrator` stores
`opts = (callback = CallbackSet(callback),)` (`SSA_stepper.jl:236`), a plain
`NamedTuple` with no tolerances. Any `ImplicitAffect` fired from an SSA solve then
threw `FieldError: type NamedTuple has no field 'abstol'`, which is the MTKBase
`InterfaceII` failure on master (`jumpsystem.jl:109`).

Return `nothing` — the nonlinear solver's own default, i.e. the pre-SciML#5080 behaviour —
when the tolerance is absent, leaving SciML#5080's intent intact for every integrator that
does carry tolerances.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Agent-Harness: Claude Code 2.1.267
Agent-Model: claude-opus-5[1m]
Agent-Session: https://claude.ai/code/session_01FeJYXni9MkJhPFA9yxYvfn
Claude-Session: https://claude.ai/code/session_01FeJYXni9MkJhPFA9yxYvfn
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 10, 2026 16:25
@ChrisRackauckas
ChrisRackauckas merged commit bf1efdb into SciML:master Sep 10, 2026
104 of 110 checks passed
ChrisRackauckas added a commit that referenced this pull request Sep 11, 2026
- Add AGENTS.md with code generation conventions (#5105)
- Fall back to the solver default when an integrator carries no tolerances (#5106)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

3 participants