Repository navigation
Zero-fill grown step history after resize! (#4722) - #4763
ChrisRackauckas-Claude wants to merge 11 commits into
Conversation
Julia's resize! leaves grown history entries undefined, and ImplicitEuler's :ie_dd2 estimator then reads them as huge EEst. Fill only the newly added history components so leftover capacity and uninitialized bits cannot poison the next step. 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/4722-cursor/log.txt on amdci2.julia.csail.mit.edu
Use leftover Array capacity filled with 2.4e77 so the uninitialized-history path is deterministic, then grow state in an ImplicitEuler callback and require ReturnCode.Success. 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/4722-cursor/log.txt on amdci2.julia.csail.mit.edu
uprev3 is not covered by Core's uprev/uprev2 fill. Resize it in resize_non_user_cache! (out of full_cache) so grown slots are zeros before :trap_dd3 reads them. 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/4722-cursor/log.txt on amdci2.julia.csail.mit.edu
Assert leftover Array capacity still retains 2.4e77 on grow, format tolerances for Runic, and require Trapezoid success after a poisoned uprev3 shrink-grow. 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/4722-cursor/log.txt on amdci2.julia.csail.mit.edu
DDE resize! only walks full_cache and then a no-op DDEIntegrator resize_non_user_cache!, so taking uprev3 out of full_cache left it unstretched and broke deleteat!/addat! index semantics. 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/4722-cursor/log.txt on amdci2.julia.csail.mit.edu
Trapezoid still needs new history slots defined. hasfield keeps this generic without a SDIRK-only resize_non_user_cache! override. 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/4722-cursor/log.txt on amdci2.julia.csail.mit.edu
DDE resize only updates full_cache entries; after growing to 5 the Trapezoid history vector must match and the remaining steps succeed. 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/4722-cursor/log.txt on amdci2.julia.csail.mit.edu
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> 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-4763/log.txt
Merged the default branch into this PR (clean merge, no conflicts; head 38d72ad) 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 01a19829-53a0-7801-8ad7-647c29ff8076, reviewed head 6d89aa1
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 zero-initializes newly grown ODE step-history slots and adds ODE/DDE resize regressions. Own runs confirm the ODE regressions fail on base and pass on head, but the PR still needs a persisted independent accuracy assertion (G1). Blast radius: Integer-sized ODEIntegrator resizing, uprev/uprev2/DAE duprev, and direct cache.uprev3; DDE test coverage is added without changing its resize implementation. Evidence: Blind diff assessment sealed before author context. ODE Integrators_II and DDE Integrators CI passed. Both failing CI errors have exact matches on recent master runs. Own Julia 1.13.2 runs: the seven added ODE assertions pass on head; five fail on base, including both solves returning Unstable. The added DDE assertions pass on both. Independent analytic probes for ImplicitEuler and Trapezoid passed; the composite probe errored in the reviewer harness before exercising that path. Blocking findings
Non-blocking findings
What I ran
What I did not verifyFull package suites and heavy downstream suites are excluded by the review execution budget. GPU-specific resize cases, DAE duprev growth, tuple-sized resizing, and other platforms have not been run locally. CI AD and GPU groups are green, but their statuses alone do not establish resize-specific GPU coverage. The cancelled DDE LTS job was not reproduced locally. Composite/default-cache growth was not executed: the final reviewer probe omitted the required CompositeAlgorithm import, and the three-run cap precludes repairing and rerunning it. The complete original resize file was run only on head; on base I ran the identical added ODE and DDE testsets, not the entire file. No DDE analytic accuracy check was performed. 🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5 |
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4763 (no session URL)
Include the TaylorDiff 0.3.6 compatibility floors and current upstream fixes while preserving the step-history initialization and accuracy regressions. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: local fixer job SciML__OrdinaryDiffEq.jl__4763 (no session URL)
Please ignore until reviewed by @ChrisRackauckas.
resize!(integrator, n)grew step-history arrays with Julia's uninitialized (or leftover-capacity) slots. ImplicitEuler:ie_dd2and Trapezoid:trap_dd3could then abort asReturnCode.Unstable. OrdinaryDiffEqCore zero-fills grownuprev/uprev2/duprevand, when the cache has a fielduprev3, those slots too.hasfielddoes not look insideCompositeCache/DefaultCachesub-caches.A previous SDIRK-only
resize_non_user_cache!that pulleduprev3out offull_cacheis reverted. DelayDiffEq'sresize!resizesfull_cacheand then a no-opresize_non_user_cache!(::DDEIntegrator, ...), souprev3must stay infull_cacheor it stays the old length (DimensionMismatch) anddeleteat!/addat!skip it.Separate pre-existing bug, still on master: after
deleteat!/addat!on in-place Trapezoid, a laterstep!canBoundsErrorinupdate_fsal!becausefsalfirstis not shortened. This PR does not fix that.Fail before / pass after
Core
uprevfill (master Core, leftover capacity2.4e77):all(iszero, integ.uprev[6:10])failed.Core
uprev3fill (SDIRKfull_cacherestored, Corehasfieldfill removed):all(iszero, integ.cache.uprev3[6:10])failed. With the fill:TRAP_UPREV3_OK.DDE:
MethodOfSteps(Trapezoid())grow 3→5 then sixstep!s:DDE_OK retcode=Success uprev3len=5.Verification
Exit 0.
DDE reproducer (same as
lib/DelayDiffEq/test/integrators/cache.jl):DDE_OK retcode=Success uprev3len=5.Follow-ups (not in this PR)
fsalfirst: still grown byresize!without a dedicated fill; DiscreteCallback re-evaluates FSAL.deleteat!/addat!plusstep!BoundsError on Trapezoidfsalfirstis pre-existing on master.resize!(integrator, i::NTuple)still does not fill history.hasfielddoes not recurse into composite/default sub-caches.Fixes #4722
Please ignore this draft until reviewed by @ChrisRackauckas.
Risk assessment
resize!(::ODEIntegrator, ::Int)history slots only.uprev3remains in SDIRKfull_cache.uprev3fill; DDE grow-and-step succeeds withlength(uprev3)==5.Harness: Cursor Agent CLI 2026.10.01-14929f9; model: auto; transcript: /log.txt
Fix by Codex CLI 0.164.0 gpt-6.1-sol (head 2c23705)
The resize regression now checks analytic decay accuracy for both ImplicitEuler and Trapezoid after the existing poisoned-history growth callbacks. At t=1, the ten original components equal exp(-1) and the five components introduced at t=0.5 equal exp(-0.5). Method-specific stability-factor bounds use the actual maximum step, with a 1e-8 allowance for floating-point and nonlinear-solve error. This addresses blocking finding G1/P2; nested-cache initialization remains the separate P3 follow-up. The commit adds 18 test lines and changes no solver implementation.
Failing before / passing after
I extracted the final official
resize! initializes grown step historytestset verbatim and ran it with identical saved test manifests, substituting only Core source: merge-base 59ba40e before, PR Core after. Each run printed the loaded Core source to confirm selection. Both used Julia 1.12.4,--compiled-modules=existing, four Julia threads and one OpenBLAS thread.Before, exit 1:
Both new accuracy assertions fail: error 0.3934693402873666 exceeds bounds 5.3722729479013455e-5 and 2.7163926431752694e-6; both solves return Unstable. After, exit 0:
Local validation
Julia 1.12.4,
JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1; every command below exited 0.GROUP=Integrators_II timeout 7200 julia --project -e 'using Pkg; Pkg.test()'Full group: 602 passed, 5 existing broken; no tests were disabled or changed to broken. Selected real output:
GROUP=QA timeout 7200 julia --project -e 'using Pkg; Pkg.test()'timeout 3600 julia --project=@runic -m Runic --inplace test/Integrators_II/resize_tests.jl git show --format= -- test/Integrators_II/resize_tests.jl | typos - git diff --check HEAD^ HEADAll three commands produced no diagnostics.
The reported Core4 CI failure is pre-existing: PR and master push logs have the same Enzyme
parallelrules.jl:233assertion,mi2 !== nothing, with matching 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. Latest master Core4 passes with Enzyme 0.13.217. This matches the existing RAT685 baseline investigation. NonlinearSolve Core's identical line-search failure also occurs on master and has an existing issue, bisect and proposed fixes. No baseline solver repair is included here.Not verified locally: full downstream suites, DDE/LTS, GPU, DAE and nested-cache growth, or docs builds. CI was checked once after pushing and is queued; its outcome is pending. The entire unfixed integrator group was not rerun: the before comparison executes the exact expanded regression testset only.
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__4763 (no session URL)
Fix by Codex CLI 0.164.0 gpt-6.1-sol (head f6cb21e)
Merged upstream master normally to include the TaylorDiff 0.3.6 compatibility floors from the upstream fix linked below. TaylorDiff 0.3.5 fails to import with ChainRules 1.74.13, producing the reported Symbolics.Num boolean error. All four reported Taylor Core/QA checks pass on the latest master push. The merge preserves this PR's three-file resize diff, including the analytic accuracy assertions addressing the blocking review finding.
Failing before / passing after
Created isolated projects with exact TaylorDiff pins of 0.3.5 and 0.3.6 and the same exact ChainRules 1.74.13 pin. Package setup used
Pkg.instantiate(; update_registry=false, allow_autoprecomp=false). Withcomparison_envselecting each isolated project, the same import command was run on Julia 1.12.4:Before, exit 1, with the manifest confirming TaylorDiff 0.3.5 / ChainRules 1.74.13:
After, exit 0:
Local validation
Julia 1.12.4,
JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 JULIA_NUM_PRECOMPILE_TASKS=1 JULIA_PKG_PRECOMPILE_AUTO=0, isolated TMPDIR. All six commands exited 0; each functional group ran in full.Taylor Core tail:
Taylor QA summaries:
Implicit Core and QA tails, respectively:
The implicit runner ignores GROUP, so its QA invocation repeats its four functional convergence assertions; it provides no separate QA coverage.
Root QA and full Integrators_II summaries:
Integrators_II totals 602 passing and five existing broken assertions; Taylor QA has one existing broken allocation assertion. No assertions were changed, disabled or loosened.
Formatting and spelling ran on the merged working tree before committing:
All exited 0 without diagnostics; the full merge Runic check covered 168 surviving Julia files.
Other prior red checks have baseline matches: Taylor downgrade and downstream jobs have the same TaylorDiff load error on master; LTS AD has the same ReverseDiff finished-recording error; GPU autoswitch has the same GPUCompiler deprecation-warning assertion; NonlinearSolve has the previously documented line-search failure. These baseline failures are outside this resize fix. Their evidence is linked below.
Not run locally: GPU, LTS AD, full downstream suites, DDE, docs, Everything, or Julia 1.13. The single post-push snapshot confirmed the new head and 71 in-progress / 189 queued checks, with no failures in that snapshot. CI completion was not awaited. Independent review of this merged head is pending.
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__4763 (no session URL)