Repository navigation
Fix Float32 short-tspan oversized tstop snap (#4738) - #4754
ChrisRackauckas-Claude wants to merge 11 commits into
Conversation
Bare 100*eps(t) can exceed a short Float32 tspan, so modify_dt_for_tstops! was setting next_step_tstop even when the proposed dt could not reach the tstop, then fixed_t_for_tstop_error! teleported t to tf after one accept. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> 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/4738-cursor/log.txt on amdci2.julia.csail.mit.edu
Reproduce the issue SciML#4738 MWE and check Float32/Float64 tstops still land with matching accept counts. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> 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/4738-cursor/log.txt on amdci2.julia.csail.mit.edu
Keep the adaptive regression beside the fixed-dt SciML#3441 case. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> 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/4738-cursor/log.txt on amdci2.julia.csail.mit.edu
When the snap flag is set, lengthen dt to the remaining interval so fixed_t_for_tstop_error! cannot teleport past unintegrated dynamics. Skip re-lengthening after adaptive rejections to avoid a reject cycle. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> 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/4738-cursor/log.txt on amdci2.julia.csail.mit.edu
Cover Float32 short spans (forward/backward) and Float64 large-t0 cases where a partial step plus tstop teleport previously under-covered the span. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> 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/4738-cursor/log.txt on amdci2.julia.csail.mit.edu
Exercise Euler and Tsit5 on the Float32/Float64 reach-the-tstop regressions. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> 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/4738-cursor/log.txt on amdci2.julia.csail.mit.edu
Add adaptive (default) u'=1 reach tests, rename Core snap tests, keep InterfaceI coverage on Euler only, and document reject_retry / snap-window invariants. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> 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/4738-cursor/log.txt on amdci2.julia.csail.mit.edu
Resolve runtests.jl conflict by keeping both the tstop snap regression and master's save_discretes initialization test include. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> 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/4738-cursor/log.txt on amdci2.julia.csail.mit.edu
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-4754/log.txt
Merged the default branch into this PR (clean merge, no conflicts; head 2380cb5) 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 |
Independent review (Codex CLI 0.166.0 / gpt-6.1-sol), session 01a19834-d46e-7ec2-823b-ad3e4a632235, reviewed head 28ed66b
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: Caps the tstop snap window and integrates the full snapped interval instead of advancing time over an unintegrated gap. The added tests pass on head, but initial-step rejection loops and explicit dtmax violations require changes. Blast radius: Common tstop handling for all ODE algorithms, including Tsit5, default solvers, callbacks, and final-time integration; shared consumers include DDE and SDE integrators. Evidence: Blind assessment sealed before author context. Head passes all 24 added Core assertions and nine added Euler assertions; independent probes reproduce initial rejection loops and dtmax violations. The identical added assertions fail on merge-base 59ba40e (23 pass, 10 fail), confirming failing-before/passing-after from my own runs. Core and InterfaceI CI pass; the two failed CI jobs have matching failures in inspected completed master runs. Blocking findings
Non-blocking findingsNone. What I ran
What I did not verifyNo full package suite or Pkg.test was run. The complete existing InterfaceI file was not executed locally; its added Euler block was extracted verbatim and tested. The new adversarial cases were executed only on head; their behavior on base was not run. DDE/SDE consumers, GPU execution, AD, Reactant, MPI, other platforms, performance, and heavy downstream suites were not run locally. GPU and AD CI groups report success, but I did not inspect their full logs or establish that they exercise the newly introduced snap/rejection combinations. I did not determine the origin of the factor-2 probe's accuracy discrepancy. 🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5 |
Use rejection statistics to protect first-step retries. Align retries within snap windows to a representable clock interval without lengthening them, and keep snapped adaptive and fixed steps within dtmax. Cover forward and backward rejections and actual accepted step sizes. 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__4754 (no session URL)
Please ignore until reviewed by @ChrisRackauckas.
Summary
In
modify_dt_for_tstops!, an oversized100*eps(t)snap tolerance could marknext_step_tstopwhendtwas still short of the remaining interval;fixed_t_for_tstop_error!then teleportedtto the tstop without integrating the gap. Cap the snap tolerance by half the step, and whenever the snap flag is set takedt = distance_to_tstopexactly (skipping re-lengthening after adaptive rejections so a stiff last step cannot reject-loop).Fixes #4738
Fail before / pass after
Issue MWE (stiff Float32 short tspan)
Master:
naccept=1,u≈0.367. With fix:Success,naccept=33,u≈2.5e-7.u' = 1teleport windowFixed-dt (
adaptive=false) and adaptive (default) Tsit5, Float32 span8epswithdt=6eps, and Float64t0=1e10span150epswithdt=110eps:min(dt, distance)): ratios 0.75 / 0.733; adaptive Core testset fails (7.15e-7 ≉ 9.54e-7,2.10e-4 ≉ 2.86e-4).tstop snap24/24.Negative control: only the adaptive-branch
dt = distanceassignment reverted tomin(original_dt, distance_to_tstop)→ adaptiveu'=1testset fails as above; fixed-dt branch still lengthens soadaptive=falsecases stay green.Verification
Runic
--check/typoson touched files: clean.InterfaceI
ode_tstops_tests.jl(Euler-onlyu'=1cases; Tsit5 covered in Core):#3441: Euler
dt=0.1on(0,1)still 11 points ending at1.0.Endpoint / step-count honesty:
Euler(); dt=0.1on(0,10)withu'=u: masteru_end=13780.612339822275→ fix13780.612339822515.naccept33/57/33/57 and 54/72/54/72).Not verified
GROUP=InterfaceICI matrix (tstops file only locally).reject_retryguard reads (accept_step,success_iter); their test suites were not run.Reviewer pushback
reject_retryshould live forever vs tightening the relative snap window further.u'=1with default tolerances is enough coverage of the lengthen path under step rejection.Risk assessment
modify_dt_for_tstops!u'=1(fixed + adaptive) fail-before/pass-after; Fix spurious tiny final step for fixed-dt methods #3441 preserved; LV bit-identical; fixed-dt endpoints shift ~1e-14 as expected; Core + InterfaceI tstops greenPlease ignore this draft until reviewed by @ChrisRackauckas.
🤖 Generated with Cursor Agent CLI (model: auto)
Transcript: /log.txt
Fix by Codex CLI 0.164.0 gpt-6.1-sol (head 6ccc3b5)
Addresses both blocking findings in the current independent review. Rejection statistics protect retries before the first accepted step. Retries within the snap window use a representable clock interval rounded toward the current time, avoiding both step growth and endpoint drift. Adaptive and fixed-step snapping respect
dtmax, including backward integration and fixed steps requested above the bound.Added forward/backward exponential regressions at decay factors 1.2, 1.4, and 1.6, plus accepted-step-size assertions for adaptive/fixed and forward/backward solves. No assertion was weakened or disabled.
Failing before / passing after
On the original PR source, the initial regression run used:
GROUP=Core timeout 7200 julia +1.12 --project=lib/OrdinaryDiffEqCore -e 'using Pkg; Pkg.test()'After adding backward-retry cases, the complete final test file was also run against the original source in a temporary environment developing the checkout's Core, Tsit5, and DiffEqBase packages. Exact Julia expression:
Final full Core run, with the fix restored:
GROUP=Core timeout 7200 julia +1.12 --project=lib/OrdinaryDiffEqCore -e 'using Pkg; Pkg.test()'Other local validation
Julia 1.12.7, four Julia threads, one OpenBLAS thread, automatic precompilation disabled, one validation command at a time.
GROUP=QA timeout 7200 julia +1.12 --project=lib/OrdinaryDiffEqCore -e 'using Pkg; Pkg.test()'Both exited 0 with no output.
typosover the generated diff andgit diff --checkalso exited 0 with no output.Baseline CI failures
The old Core4 assertion is inherited: latest master Core4 passes 16 assertions with two existing broken assertions using Enzyme 0.13.217. The failing PR log used 0.13.216; the existing RAT685 investigation traces its threading assertion. No OrdinaryDiffEq source workaround was added.
The Newton
LineSearchExceptionalso appears in master CI. Issue 4681 already records clean-master reproduction and a bisect to 498c765ccc07522b48e6cb8df0567e734c0a46c1. The latest sublibrary workflow omits that package through path filtering, so it does not establish resolution. MTK5335 concerns causal-equation test orientation and does not apply to either failed check.Limits and risk
Full root InterfaceI, downstream suites, DDE/SDE consumers, GPU execution, other Julia versions, benchmarks, and documentation builds were not run locally. No docstring or public API was added. The inherited high-risk assessment remains appropriate for this shared time-stepping path; independent review of this final head is pending. This fix session does not supply a counted review.
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__4754 (no session URL)