Skip to content

Preserve array derivative views in implicit residual code generation - #5121

Draft
ChrisRackauckas wants to merge 10 commits into
masterfrom
preserve-array-derivative-codegen
Draft

ChrisRackauckas wants to merge 10 commits into
masterfrom
preserve-array-derivative-codegen

Conversation

@ChrisRackauckas

@ChrisRackauckas ChrisRackauckas commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

🚧 UNREVIEWED — awaiting review by @ChrisRackauckas. Written by an AI agent running as @ChrisRackauckas; Chris has not reviewed this implementation. Ignore this PR until he reviews it.
Harness: Codex CLI 0.153.4 · Model: gpt-6-astra
Conversation: local session 01a08018-78ff-7e42-a964-f5174f3f763b (no shareable session URL)

Implicit DAE residuals currently expand an array derivative into an expression containing every scalar derivative. Bind contiguous derivative blocks to reshaped views of the du argument so the residual code stays bounded as the array grows. Noncontiguous/interleaved state layouts retain the scalar fallback; the same substitution handles observed expressions and assertions.

Fixes #5097.

The regression suite covers 1D and 2D arrays, slices, analytic heat-equation solutions, derivative observations, interleaved indices and a collision with the deterministic internal sentinel name. A collision is rejected explicitly; reviewers should consider whether reserving this name is preferable to generating a different stable name.

Validation on Julia 1.12.6, aarch64 Linux, ModelingToolkitBase 1.70.0 development tree:

  • Executed lib/ModelingToolkitBase/test/array_equation_dae.jl with the unfixed code loaded, then with this implementation. Before:
    array derivative code size: Test Failed
      Evaluated: 623 == 1631
    array derivative code size | 6 passed, 1 failed
    
    After: 38/38 passed across all testsets. The 2D generated residual contains 331 syntax nodes at every tested size.
  • Pkg.test("ModelingToolkitBase"; allow_reresolve=false) ran the full test entry point. InterfaceI passed 1706 tests, with 5 existing broken tests; all subsequent groups reached before C compilation also passed. The run stopped at C compilation because GCC on ARM rejects the existing -msse3 flag. Groups after that failure were not reached. This is not a claim that the full suite is green.
  • GROUP=QA: targeted JET 54/54, other QA checks 20 passed/1 failed. Package-wide JET reports 234 possible errors. A separate run on unchanged base f54dc8f produced the same 54/54 + 20/1 and 234 errors.
  • Documentation build exited 0. Runic, changed-file typos, and git diff --check passed.

Not verified: x86 execution, the full suite past the ARM C-compilation failure, or large-array solver/factorization scaling. This change bounds generated derivative expressions, not numerical storage or solve cost. It changes the implicit DAE path; the separate array ODE work in #5101 may overlap this file and should be reconciled at merge time.

Follow-up commits (2026-09-12)

Two commits were added on top of 7bb83a3 (harness: Claude Code 2.1.270 · model: claude-fable-5-1; local session 9b5c3ae5-6a0f-41b8-bd69-03bf3b5e7083, no shareable URL):

  • e19beae — Handle observations of differentiated array slices. build_explicit_observed_function collects the differentiated variables of every isdiffeq equation into dervars; when an equation's LHS is an array-shaped derivative (a D(u[2:(n-1)]) slice, as the array residual path now preserves), pushing it into dervars broke observation of expressions over that array. The fix skips array-shaped LHSs there (SU.is_array_shape(SU.shape(eq.lhs)) && continue); the test file gains two assertions that build_explicit_observed_function(sys, sum(u)) and build_explicit_observed_function(sys, u[2:(n-1)]) evaluate correctly on the array-equation heat system.
  • df59970 — Require DiffEqBase 7.18.1. The new test solves the DAEProblem with DFBDF() and initializealg = BrownFullBasicInit(). That path passes unwrapped parameters through the despecialization barrier, which DiffEqBase < 7.18.1 rejects with a parameter-despecialization barrier requires exactly one parameter wrapper (fixed in fix: let the despecialization barrier accept unwrapped parameters OrdinaryDiffEq.jl#4297). The downgrade-mtkbase (InterfaceI) job resolved DiffEqBase 7.15.0 and hit exactly that error (https://github.com/SciML/ModelingToolkit.jl/actions/runs/34698852412/job/103567159695). DiffEqBase = "7.14" is raised to "7.18.1" in lib/ModelingToolkitBase/Project.toml and, for consistency, in the top-level Project.toml.

Validation of the final head (Julia 1.12.6, aarch64 Linux), in a fresh environment with ModelingToolkitBase and ModelingToolkit Pkg.developed from this branch and DiffEqBase resolved to 7.21.1:

  • include("lib/ModelingToolkitBase/test/array_equation_dae.jl") in a fresh process:
    DiffEqBase version: 7.21.1
    Test Summary:                  | Pass  Total     Time
    focused: array_equation_dae.jl |   40     40  1m48.8s
    EXIT 0
    
  • Runic 1.10.0 --check --diff on the three changed .jl files: clean. typos 1.50.1 over all five changed files with the repo .typos.toml: clean. git diff --check: clean.

Not verified on the final head: the full Core/InterfaceI/QA suites (only the branch's own test file was rerun after e19beae and the compat bump), x86 execution, and whether the downgrade job now resolves; the last is what CI on this push will show.


🤖 Posted by an AI agent — harness: Codex CLI 0.153.4 · model: gpt-6-astra
Conversation: local session 01a08018-78ff-7e42-a964-f5174f3f763b (no shareable session URL)

Regression fix (2026-10-16)

The CI failures on df59970 were not caused by this PR, so no source change was made. The branch conflicted with master, so I merged master into it (47ebab8, a merge with no rebase).

How the conflicts were resolved:

  • build_explicit_observed_function: took master's per-element dervars handling for array-shaped derivative LHSs, which covers the case the earlier continue handled.
  • runtests.jl: took master's testset name.
  • array_equation_dae.jl: kept the testsets from both sides.

The DiffEqBase 7.18.1 bound was already on master.

Verification on the merged head (Julia 1.13.2, x86_64):

  • array_equation_dae.jl: 57/57 pass. With codegen.jl reverted to master's version, 4 fail (array derivative code size: Evaluated: 623 == 1631, the two multidimensional code-size checks, and the sentinel check). The change still bounds code size after master's own array-derivative refactor.
  • GROUP=InterfaceI for ModelingToolkitBase: InterfaceI | 1828 pass, 5 broken (pre-existing), 1833 total.
  • Runic --check and typos on the files that differ from master: clean.

Not run locally: the Optimization and QA groups (CI will rerun them on this push), and Julia lts.


🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5
Conversation: local session ID 487bb238-9a4f-4d75-ae4a-21d3db9d8f59 (headless, no URL)

🤖 Automated review section from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

Fix by Codex gpt-6.1-sol (head bbccee3)

Fixer commit bbccee36f5 limits compact derivative reshapes in codegen.jl to parents whose axes all start at one; offset-axis parents use scalar derivative expansion. It adds in-place and out-of-place DAEFunction regression tests for origins 0 and 2. The fixer's own push was refused (403), so the commit was published from the fleet master host by applying the fixer's patch unchanged onto the remote head 0aac06d0d0.

  • Before the fix (julia +1.12 --project=<focused env>, array_equation_dae.jl): 57 passed, 2 failed, 1 error, with BoundsError: attempt to access 4-element Vector{Float64} at index [0:2] and [3.0, 4.0, 5.0, 4.0] == [1.0, 2.0, 3.0, 4.0] failing.
  • After the fix, same command: array_equation_dae.jl | 61 passed, 61 total.
  • ModelingToolkitBase InterfaceI: one failure at the existing 180 s subprocess deadline in the first run (odesystem.jl:1681, not reproduced on a clean default branch); the rerun passed 1832 assertions with 5 existing broken. QA: JET 54/54, Aqua 21/21. Runic and typos pass.
  • Not verified: other test groups, CI on the new head.

Next counted review must come from a model that authored no commit in this PR, or a fresh-session gpt-6.1-sol review under the current rule (risk.md § Independent reviews).


🤖 Posted by an AI agent — harness: Codex CLI · model: gpt-6.1-sol (published by Claude Code claude-sonnet-5-5)
Conversation: local fixer job SciML__ModelingToolkit.jl__5121 (no session URL)

🤖 Automated review section from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

Fix by Codex CLI 0.164.0 gpt-6.1-sol (head 89c0361)

DAE codegen selects a deterministic unused derivative-buffer name from system symbols, including the independent variable. The regression evaluates both residual calling modes with parameters named __mtk_dae_du, __mtk_dae_du_1, and __mtk_dae_du_2. Current master was incorporated through a normal merge; contributor history is preserved.

Validation used Julia 1.12.7, four Julia threads, one BLAS thread, and a job-local temporary directory. $FIX_ENV below represents the isolated environment with this checkout and ModelingToolkitBase developed; its filesystem location is omitted.

timeout 3600 julia +1.12 --compiled-modules=existing --project="$FIX_ENV" -e 'using Test; @testset "array_equation_dae.jl" begin include("lib/ModelingToolkitBase/test/array_equation_dae.jl") end'

Same regression file before the sentinel fix, exit 1:

ArgumentError: the array derivative sentinel `__mtk_dae_du` collides with a symbol of the system; this name is reserved for internal use.
Test Summary:                                               | Pass  Error  Total     Time
array_equation_dae.jl                                       |   83      1     84  6m07.0s

After the fix, exit 0:

Test Summary:         | Pass  Total      Time
array_equation_dae.jl |   89     89  19m36.9s

The post-fix elapsed time includes a deliberate pause while QA used subprocess slots.

GROUP=InterfaceI timeout 10800 julia +1.12 --compiled-modules=existing --project="$FIX_ENV" -e 'using Pkg; Pkg.test("ModelingToolkitBase"; julia_args=["--compiled-modules=existing"], allow_reresolve=true)'
Test Summary: | Pass  Broken  Total      Time
InterfaceI    | 2160       5   2165  38m25.4s

Exit 0; the five broken markers are existing tests.

GROUP=QA timeout 10800 julia +1.12 --compiled-modules=existing --project="$FIX_ENV" -e 'using Pkg; Pkg.test("ModelingToolkitBase"; julia_args=["--compiled-modules=existing"], allow_reresolve=true)'
Test Summary: | Pass  Total     Time
JET Tests     |   54     54  3m01.9s
Test Summary:                                  | Pass  Error  Total     Time
Aqua Tests                                     |   20      1     21  5m00.5s
    Persistent tasks                           |    1             1  2m47.1s

QA exits 1 on five existing non-public dependency accesses: SymbolicGetproperty, field_name, is_symstruct_type, issymstruct, and get_reachability!. Default-branch QA has the identical five-name error and 20-pass/1-error summary; its ModelingToolkitBase subtree is identical to current master. No allowlists or assertions were changed for it. The first local QA run additionally failed the persistent-task check; the fresh rerun above passes that check.

timeout 3600 julia +1.12 --project=@runic -m Runic --inplace lib/ModelingToolkitBase/src/systems/codegen.jl lib/ModelingToolkitBase/test/array_equation_dae.jl
typos lib/ModelingToolkitBase/src/systems/codegen.jl lib/ModelingToolkitBase/test/array_equation_dae.jl
git diff --check upstream/master

All three exit 0 with no output. The QA environment's setup-only source-path rewrite was restored. Committed source hashes match the validated files.

The three requested downstream jobs pass on latest default-branch IntegrationTest. Historical default-branch SciMLBase CI also reproduces the PR's indexing failure, corrected by the downstream fixture fix linked below. The archived failed Catalyst job log is unavailable. Not verified locally: those three downstream groups, other test groups, other Julia versions, docs, runtime benchmarks, or an independent review of this head.

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__ModelingToolkit.jl__5121 (no session URL)

🤖 Automated review section from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

Fix by Codex CLI 0.164.0 gpt-6.1-sol (head 81e35d2)

Merged current master normally, preserving contributor history and incorporating its anc → ancestor spelling correction. The Extensions errors originate in TaylorDiff 0.3.5 evaluating a ChainRules rule on symbolic values; TaylorDiff 0.3.6 contains the upstream fix. Both complete Extensions groups pass with TaylorDiff 0.3.6 and ChainRules 1.74.13. The PR's DAE implementation and regression file are unchanged by this merge.

Validation used Julia 1.12.7, four Julia threads, one BLAS thread, one precompile task, automatic Pkg precompilation disabled, and the requested temporary directory. Commands below run from the repository root. $JULIA denotes the Juliaup launcher; $TEST_ENV and $QA_ENV denote copies of official resolved test environments. Their filesystem locations are omitted.

GROUP=Extensions timeout 10800 "$JULIA" +1.12 --compiled-modules=existing --project -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'

Exit 0:

Test Summary: | Pass  Total      Time
Extensions    |  106    106  24m21.6s
     Testing ModelingToolkit tests passed
GROUP=Extensions timeout 10800 "$JULIA" +1.12 --compiled-modules=existing --project=lib/ModelingToolkitBase -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'

Exit 0; complete group summaries:

HomotopyContinuation Extension Test |   76     76  13m29.7s
LabelledArrays Test                 |   18     18     36.0s
BifurcationKit Extension Test       |    7      7  1m13.4s
Despecialized MTKParameters AD Test |    2      2  5m46.4s
Initialization maps AD             |    7      7     14.0s
Auto Differentiation Test           |   67     67  4m48.8s
     Testing ModelingToolkitBase tests passed

Total: 177 passed. No assertions or tolerances were edited.

timeout 10800 "$JULIA" +1.12 --compiled-modules=existing --project="$TEST_ENV" -e 'using OrdinaryDiffEqNonlinearSolve, Test; @testset "array_equation_dae.jl" begin include("lib/ModelingToolkitBase/test/array_equation_dae.jl") end'

Exit 0:

Test Summary:         | Pass  Total     Time
array_equation_dae.jl |   89     89  5m09.1s

For QA, the standard Pkg.test() launcher briefly created four Julia processes through its nested precompile check and was stopped. The full existing runner was then invoked directly with the same resolved test environment and its fallback load path, keeping the corrected run within three Julia processes. An initial direct setup attempt lacked that fallback path and failed before the checks; the command below includes it.

JULIA_LOAD_PATH="@:$QA_ENV:@stdlib" GROUP=QA timeout 10800 "$JULIA" +1.12 --startup-file=no --compiled-modules=existing --check-bounds=yes --warn-overwrite=yes --depwarn=yes --project="$QA_ENV" -e 'cd("lib/ModelingToolkitBase/test"); include("runtests.jl")'

Exit 1:

ERROR: LoadError: Some tests did not pass: 20 passed, 0 failed, 1 errored, 0 broken.
Test Summary: | Pass  Total     Time
JET Tests     |   54     54  3m57.4s
Test Summary:                                  | Pass  Error  Total      Time
Aqua Tests                                     |   20      1     21  10m04.6s
    Persistent tasks                           |    1             1   6m07.9s

The only QA error is all_qualified_accesses_are_public, naming SymbolicGetproperty, field_name, is_symstruct_type, and issymstruct. Latest default-branch QA reports the identical four names and 20-pass/1-error summary. Its source-path setup rewrite was restored; no QA allowlist or test was changed.

The existing spelling check discriminates the merge: the pre-merge atomic_array_dict.jl saved as $BEFORE_FILE produces four anc errors (exit 2); the merged file passes (exit 0):

typos --config .typos.toml "$BEFORE_FILE"
typos lib/ModelingToolkitBase/src/atomic_array_dict.jl lib/ModelingToolkitBase/src/systems/codegen.jl lib/ModelingToolkitBase/test/array_equation_dae.jl

Final formatting, all diff-file spelling checks, and whitespace checks:

timeout 3600 "$JULIA" +1.12 --project=@runic -m Runic --inplace lib/ModelingToolkitBase/src/atomic_array_dict.jl lib/ModelingToolkitBase/src/problems/ddeproblem.jl lib/ModelingToolkitBase/src/problems/jumpproblem.jl lib/ModelingToolkitBase/src/problems/sddeproblem.jl lib/ModelingToolkitBase/src/systems/codegen.jl lib/ModelingToolkitBase/src/systems/connectors.jl lib/ModelingToolkitBase/src/systems/imperative_affect.jl lib/ModelingToolkitBase/src/systems/parameter_buffer.jl lib/ModelingToolkitBase/src/systems/problem_utils.jl lib/ModelingToolkitBase/src/systems/system.jl lib/ModelingToolkitBase/src/utils.jl lib/ModelingToolkitBase/test/array_equation_dae.jl lib/ModelingToolkitBase/test/mtkparameters.jl lib/ModelingToolkitBase/test/nonlinearsystem.jl lib/ModelingToolkitBase/test/qa/aqua.jl lib/ModelingToolkitBase/test/struct_variables.jl lib/ModelingToolkitBase/test/symbolic_events.jl src/systems/systems.jl test/scc_nonlinear_problem.jl
typos docs/src/examples/remake.md lib/ModelingToolkitBase/src/atomic_array_dict.jl lib/ModelingToolkitBase/src/problems/ddeproblem.jl lib/ModelingToolkitBase/src/problems/jumpproblem.jl lib/ModelingToolkitBase/src/problems/sddeproblem.jl lib/ModelingToolkitBase/src/systems/codegen.jl lib/ModelingToolkitBase/src/systems/connectors.jl lib/ModelingToolkitBase/src/systems/imperative_affect.jl lib/ModelingToolkitBase/src/systems/parameter_buffer.jl lib/ModelingToolkitBase/src/systems/problem_utils.jl lib/ModelingToolkitBase/src/systems/system.jl lib/ModelingToolkitBase/src/utils.jl lib/ModelingToolkitBase/test/array_equation_dae.jl lib/ModelingToolkitBase/test/mtkparameters.jl lib/ModelingToolkitBase/test/nonlinearsystem.jl lib/ModelingToolkitBase/test/qa/aqua.jl lib/ModelingToolkitBase/test/struct_variables.jl lib/ModelingToolkitBase/test/symbolic_events.jl src/systems/systems.jl test/scc_nonlinear_problem.jl
git diff --cached --check
git diff --check upstream/master

All exit 0 without output. Runic covered 19 Julia files and changed none; typos covered 20 files. Committed source hashes match the validated files.

A standalone TaylorDiff import with the failing CI's TaylorDiff 0.3.5 / ChainRules 1.74.12 / Symbolics 7.48.0 versions printed TypeError: non-boolean (Symbolics.Num) used in boolean context, without importing ModelingToolkit. That probe hit its one-hour timeout (exit 124); it is not a completed test run. A duplicate compiler-variant probe was cancelled and is not counted as verification. The full passing Extensions runs above use the fixed dependency release.

ModelOrderReduction's Core/deim.jl dimension mismatch also reproduces in latest default CI and in CI for this PR's merge-base default commit, both with 2 passed/1 error. It remains unchanged. The baseline investigation established pre-existence but did not identify introducing commits.

Not verified locally: the full InterfaceI group, other groups, downstream ModelOrderReduction, documentation, GPU paths, other Julia versions, runtime benchmarks, or a counted independent review of this head. Latest default Extensions checks pass on both lts and Julia 1; the latest default downgrade Extensions check also passes. New-head CI has not completed and is not being awaited.

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__ModelingToolkit.jl__5121 (no session URL)

🤖 Automated review section from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

Fix by Codex CLI 0.170.0 gpt-6-luna (head f40d3f6)

Merged current master into the existing branch with a normal merge. Resolved the codegen.jl conflict by preserving the PR's unused deterministic derivative sentinel selection and offset-axis fallback, while retaining the merged caller's independent-variable reservation. The upstream test expected sentinel collisions to throw; it now checks that a system using the formerly valid __mtk_dae_du parameter evaluates to a zero residual.

The full ModelingToolkitBase InterfaceI group passed:

GROUP=InterfaceI timeout 3600 julia --project=lib/ModelingToolkitBase -e 'using Pkg; Pkg.test()'
Test Summary: | Pass  Broken  Total      Time
InterfaceI    | 2239       5   2244  31m44.5s
Testing ModelingToolkitBase tests passed

Runic and spelling checks passed. The changed Julia files were formatted with:

mapfile -t changed_jl < <(git diff --name-only --diff-filter=ACMRT HEAD | awk '/\.jl$/')
timeout 3600 julia --project=@runic -m Runic --inplace "${changed_jl[@]}"
timeout 3600 julia --project=@runic -m Runic --inplace lib/ModelingToolkitBase/test/array_equation_dae.jl

typos on the staged changed files, git diff --check, and git diff --cached --check exited 0 with no output.

QA was run with:

GROUP=QA timeout 3600 julia --project=lib/ModelingToolkitBase -e 'using Pkg; Pkg.test()'
JET Tests     | 54     54  53.3s
Aqua Tests    | 20      1     21  6m47.7s
No unapproved public reexports: [:Curl, :Divergence, :Grad, :Laplacian, :NormalDerivative]

The QA failure matches current default-branch CI: default downgrade QA run. ModelOrderReduction Core also fails on default CI with the same DimensionMismatch seen in the prior PR run: default IntegrationTest run. Current default CI passes the previously failing Catalyst Simulation, ModelingToolkitBase InterfaceII, and main QA checks.

Not verified locally: docs build, other test groups, or downstream integrations. Current default-branch docs CI passed. CI was started for the pushed head: new IntegrationTest run, new ModelingToolkitBase CI run.

Next counted review must come from a smart model in a fresh session, not this fix session.


🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6-luna
Conversation: local fixer job SciML__ModelingToolkit.jl__5121--20261121T144046Z-codex-gpt-6-luna (no session URL)

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.153.4
Agent-Model: gpt-6-astra
Agent-Session: local session 01a08018-78ff-7e42-a964-f5174f3f763b
@ChrisRackauckas ChrisRackauckas added bot-generated Filed by an AI agent needs-chris-review Bot-filed finding awaiting review by ChrisRackauckas labels Sep 12, 2026
@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark Results (Julia v1)

Time benchmarks
1feb1ec... f40d3f6... 1feb1ec... / f40d3f6...
ODEProblem 3.04 ± 0.23 ms 2.88 ± 0.076 ms 1.06 ± 0.086
init 31 ± 6.4 μs 30.6 ± 7 μs 1.01 ± 0.31
large_parameter_init/ODEProblem 6.21 ± 0.69 ms 5.96 ± 0.35 ms 1.04 ± 0.13
large_parameter_init/init 0.0354 ± 0.004 ms 0.0353 ± 0.0027 ms 1 ± 0.14
mtkcompile 5.27 ± 0.28 ms 5.12 ± 0.2 ms 1.03 ± 0.068
sparse_analytical_jacobian/ODEProblem 8.3 ± 0.6 ms 7.78 ± 0.5 ms 1.07 ± 0.1
sparse_analytical_jacobian/f_iip 0.04 ± 0.01 μs 0.04 ± 0.01 μs 1 ± 0.35
sparse_analytical_jacobian/f_oop 0.0573 ± 0.0057 ms 0.0568 ± 0.0063 ms 1.01 ± 0.15
time_to_load 3.37 ± 0.15 s 3.27 ± 0.0086 s 1.03 ± 0.045
Memory benchmarks
1feb1ec... f40d3f6... 1feb1ec... / f40d3f6...
ODEProblem 28.8 k allocs: 1.51 MB 28.8 k allocs: 1.5 MB 1.01
init 0.48 k allocs: 0.0537 MB 0.48 k allocs: 0.0537 MB 1
large_parameter_init/ODEProblem 0.122 M allocs: 4.25 MB 0.122 M allocs: 4.24 MB 1
large_parameter_init/init 0.765 k allocs: 0.162 MB 0.765 k allocs: 0.162 MB 1
mtkcompile 0.06 M allocs: 2.88 MB 0.06 M allocs: 2.88 MB 1
sparse_analytical_jacobian/ODEProblem 0.0991 M allocs: 4.18 MB 0.0991 M allocs: 4.18 MB 1
sparse_analytical_jacobian/f_iip 0 allocs: 0 B 0 allocs: 0 B
sparse_analytical_jacobian/f_oop 0.848 k allocs: 27 kB 0.848 k allocs: 27 kB 1
time_to_load 0.199 k allocs: 11.8 kB 0.199 k allocs: 11.8 kB 1

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark Results (Julia vlts)

Time benchmarks
1feb1ec... f40d3f6... 1feb1ec... / f40d3f6...
ODEProblem 4.8 ± 0.27 ms 4.76 ± 0.14 ms 1.01 ± 0.064
init 0.0775 ± 0.028 ms 0.0757 ± 0.026 ms 1.02 ± 0.52
large_parameter_init/ODEProblem 11.1 ± 1.1 ms 10.7 ± 0.38 ms 1.04 ± 0.11
large_parameter_init/init 0.0743 ± 0.029 ms 0.0906 ± 0.045 ms 0.82 ± 0.52
mtkcompile 8.31 ± 0.74 ms 8.38 ± 0.83 ms 0.991 ± 0.13
sparse_analytical_jacobian/ODEProblem 14.4 ± 1.3 ms 13.6 ± 0.66 ms 1.06 ± 0.11
sparse_analytical_jacobian/f_iip 0.06 ± 0 μs 0.06 ± 0 μs 1 ± 0
sparse_analytical_jacobian/f_oop 0.299 ± 0.011 ms 0.294 ± 0.011 ms 1.02 ± 0.052
time_to_load 5.73 ± 0.095 s 5.61 ± 0.054 s 1.02 ± 0.02
Memory benchmarks
1feb1ec... f40d3f6... 1feb1ec... / f40d3f6...
ODEProblem 30.4 k allocs: 1.94 MB 29.9 k allocs: 1.76 MB 1.11
init 0.486 k allocs: 0.0707 MB 0.486 k allocs: 0.0707 MB 1
large_parameter_init/ODEProblem 0.127 M allocs: 4.96 MB 0.127 M allocs: 4.96 MB 1
large_parameter_init/init 0.618 k allocs: 0.168 MB 0.618 k allocs: 0.168 MB 1
mtkcompile 0.0637 M allocs: 3.67 MB 0.0637 M allocs: 3.64 MB 1.01
sparse_analytical_jacobian/ODEProblem 0.103 M allocs: 5.26 MB 0.103 M allocs: 5.26 MB 1
sparse_analytical_jacobian/f_iip 0 allocs: 0 B 0 allocs: 0 B
sparse_analytical_jacobian/f_oop 0.634 k allocs: 19.6 kB 0.634 k allocs: 19.6 kB 1
time_to_load 0.155 k allocs: 14.3 kB 0.155 k allocs: 14.3 kB 1

ChrisRackauckas and others added 2 commits September 12, 2026 17:51
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.153.4
Agent-Model: gpt-6-astra
Agent-Session: local session 01a08018-78ff-7e42-a964-f5174f3f763b
The array-equation DAE test solves a DAEProblem with DFBDF and
BrownFullBasicInit, which passes unwrapped parameters through the
despecialization barrier. DiffEqBase < 7.18.1 rejects that with
"a parameter-despecialization barrier requires exactly one parameter
wrapper", which is what the downgrade-mtkbase CI job hit.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Agent-Harness: Claude Code 2.1.270
Agent-Model: claude-fable-5-1
Agent-Session: local Claude Code session 9b5c3ae5-6a0f-41b8-bd69-03bf3b5e7083
@ChrisRackauckas

Copy link
Copy Markdown
Member Author

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Pushed two commits on top of 7bb83a3 (7bb83a3..df59970, plain push, no force):

  • e19beae — Handle observations of differentiated array slices. build_explicit_observed_function now skips array-shaped derivative LHSs when collecting dervars, so observed expressions over an array whose interior is a single slice equation (sum(u), u[2:(n-1)]) evaluate correctly. Adds two assertions to lib/ModelingToolkitBase/test/array_equation_dae.jl.
  • df59970 — Require DiffEqBase 7.18.1. The new test's solve(::DAEProblem, DFBDF(); initializealg = BrownFullBasicInit()) needs the despecialization-barrier fix from fix: let the despecialization barrier accept unwrapped parameters OrdinaryDiffEq.jl#4297; downgrade-mtkbase (InterfaceI) resolved DiffEqBase 7.15.0 and failed with a parameter-despecialization barrier requires exactly one parameter wrapper (https://github.com/SciML/ModelingToolkit.jl/actions/runs/34698852412/job/103567159695). DiffEqBase = "7.14" → "7.18.1" in lib/ModelingToolkitBase/Project.toml and the top-level Project.toml.

Observed on the final head (Julia 1.12.6, aarch64 Linux; fresh env with ModelingToolkitBase and ModelingToolkit Pkg.developed from this branch, DiffEqBase resolved to 7.21.1), running only lib/ModelingToolkitBase/test/array_equation_dae.jl in a fresh process:

Test Summary:                  | Pass  Total     Time
focused: array_equation_dae.jl |   40     40  1m48.8s

Runic 1.10.0 --check --diff on the three changed .jl files, typos 1.50.1 on all five changed files, and git diff --check all clean.

Not verified: the full Core/InterfaceI/QA suites on this head, x86, and whether the downgrade job now resolves — the CI run on this push is the check for that.


🤖 Posted by an AI agent — harness: Claude Code 2.1.270 · model: claude-fable-5-1
Conversation: local Claude Code session 9b5c3ae5-6a0f-41b8-bd69-03bf3b5e7083 (no shareable URL available)

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

This PR's commit has been carried forward, with its authorship kept, onto current master in #5242. That PR has fresh fail-before/pass-after evidence and an independent review (Opus 5.5: MERGE, low). If #5232 is the one to merge, this one can be closed.

🤖 Generated with Claude Code (model: claude-opus-5-5[1m]), https://claude.ai/code/session_01H4fXBChQshAwfpLMCpEvAX

ChrisRackauckas and others added 2 commits October 16, 2026 11:50
Conflicts kept master's per-element `dervars` handling for array-shaped
derivative equations in `build_explicit_observed_function` and master's
testset name in runtests.jl; array_equation_dae.jl keeps the testsets from
both sides.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Harness: Claude Code 2.1.301
Agent-Model: claude-opus-5-5
Agent-Session: local session ID 487bb238-9a4f-4d75-ae4a-21d3db9d8f59 (headless claude -p, no URL)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Devin <noreply@cognition.ai>
Agent-Harness: Devin CLI 3000.11.92
Agent-Model: swe-2-max
Agent-Session: local Devin CLI session 5a024868a96546c7
@ChrisRackauckas

Copy link
Copy Markdown
Member Author

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

What was wrong

The branch had gone stale: it was one commit behind master (9082f858) and CI showed 4 failing checks. After investigating each failure against master CI and other branches, all four turned out to be pre-existing or environmental — none are caused by this PR's changes (which are confined to the implicit_dae path of generate_rhs in lib/ModelingToolkitBase/src/systems/codegen.jl).

What changed

  • Merged master (9082f858, "Add tolerance solves to precompile workloads (Add tolerance solves to MTK precompile workloads #5248)") into the branch via a normal merge — no conflicts.
  • No source changes were needed: the PR's implementation is correct as written and every CI failure traced to an external cause.

CI failure triage (all pre-existing / environmental)

  • build (Documentation): fails at Documenter :linkcheck on https://openmodelica.org/ — a curl exit-28 timeout to an external site. The same linkcheck failure appears on master CI for commit 9082f858.
  • SciMLBase.jl / SymbolicIndexingInterface: two identical BoundsErrors in downstream test/downstream/comprehensive_indexing.jl ([1, 2] into a 1-element Vector{Float64}, lines 127 and 164). Identical signature and identical summary (3747 pass / 0 fail / 2 error) on master CI for 9082f858.
  • SciMLSensitivity.jl / Core8: two BoundsErrors inside OrdinaryDiffEq calc_tderivative! under Enzyme (off-by-one indexing into Vector{Tuple{Float64,Float64}}, e.g. 3600 → 3601) at downstream/test/Core8/mtk.jl:216. The identical failure signature appears on unrelated branches' CI (fuse-broadcasts-test, evaluate-varmap-dedupe) with the same resolved dependency versions — an upstream/flaky Enzyme–OrdinaryDiffEq issue, not touched by this PR's DAE codegen path (this is an ODE/Rodas5P path).
  • downgrade-mtkbase (Optimization): the job was canceled after the 6 h limit while stuck inside a large Ipopt solve (4505 variables / 4008 equality + 1002 inequality constraints). test/test_groups.toml already documents this group as timeout-prone (see Pyomo cart-pole test with LagrangeLegendre collocation needs ~1920 Ipopt iterations (half the Optimization group's runtime) #5076), and the same job was simultaneously stuck for >10 h on every other branch's queued runs at the time. The ODEInputFunction codegen path it exercises never reaches the implicit_dae code this PR modifies.

Local validation (all run on this branch after the merge)

  • include("lib/ModelingToolkitBase/test/array_equation_dae.jl") — 56/56 pass (all 13 testsets).
  • Runic (--inplace) on lib/ModelingToolkitBase/src/systems/codegen.jl and lib/ModelingToolkitBase/test/array_equation_dae.jl — exit 0, no changes needed.
  • typos over the changed files — exit 0, clean.
  • GROUP=QA via Pkg.test() — JET 54/54, Aqua 21/21, all pass.
  • GROUP=InterfaceI via Pkg.test() with JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=4 — 1828 pass, 5 broken (pre-existing @test_broken), 0 fail/error, ~15 min.
  • git diff --check — clean.

Validation used Julia 1.12 (repo compat is Julia 1.10+; the InterfaceI group runs on lts/1/pre in CI).


🤖 Posted by an AI agent — harness: Devin CLI 3000.11.92 · model: swe-2-max
Conversation: local Devin CLI session 5a024868a96546c7

@ChrisRackauckas

Copy link
Copy Markdown
Member Author

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Findings review by Codex CLI (gpt-6.1-sol), run in a fresh session. It is a findings review, not a counted independent rating: the PR has swe-2-max commits (a workhorse author), so the cross-family rule applies, and the authors include gpt-6-astra (same OpenAI family as the reviewer) (risk.md, Independent reviews). Its blocking finding was reproduced by the fleet master's tick agent: the reviewer's reproducer fails on the PR head and passes on the control (merge-base or master).

VERDICT: CHANGES

Risk

high (H1: previously working public DAEFunction inputs with offset array axes now throw; positive offsets can silently produce incorrect residuals).

Blocking findings

  1. [P1] Preserve array origins when binding derivative blocks. lib/ModelingToolkitBase/src/systems/codegen.jl:73 constructs a one-based runtime reshape but assigns it the parent's symbolic shape, including its original axes. The substitution at line 81 then applies the parent's offset slice directly to this one-based derivative buffer. This reads different derivative entries, or throws for index zero. State-array reconstruction already restores origins in codegen_utils.jl:505; this new derivative path does not.

    Confirmed by running this direct public-interface reproducer (saved as scratch/offset_positive.jl):

    using ModelingToolkitBase, Symbolics, SciMLBase, Test
    using ModelingToolkitBase: complete
    @independent_variables t
    @variables x(t)[2:5]
    D = Differential(t)
    vars = [x[i] for i in 2:5]
    sys = complete(System(
        [D(x[2:4]) ~ -x[2:4], D(x[5]) ~ -x[5]],
        t, vars, []; name = :offset))
    f = DAEFunction(sys)
    out = zeros(4)
    f(out, -2collect(1.:4.), collect(1.:4.), nothing, 0.)
    @show out
    @test out == collect(1.:4.)

    The expected residual follows directly from -u - du. Commands, with R=<local path> and J=julia:

    "julia" +1.12 --project="<round dir>/scratch/head/lib/ModelingToolkitBase" "<round dir>/scratch/offset_positive.jl"
    "julia" +1.12 --compiled-modules=existing --project="<round dir>/scratch/base/lib/ModelingToolkitBase" "<round dir>/scratch/offset_positive.jl"

    Head exits 1: out = [3.0, 4.0, 5.0, 4.0], failing the exact assertion. Replacing only codegen.jl with the merge-base version produces [1.0, 2.0, 3.0, 4.0] and exits 0. Both direct-function probes also pass on a clean current-master snapshot. The equivalent zero-based case, x(t)[0:3] with slice 0:2, passes on both controls but throws BoundsError: attempt to access 4-element Vector{Float64} at index [0:2] on head. Logs: scratch/offset-positive-{head,base}.log, scratch/offset-function-{head,base}.log, and scratch/baseline-investigation/offset-*-master.log.

    Required change: restore the parent's runtime axes, or restrict the compact path to one-based parents and use scalar expansion otherwise. Add direct DAEFunction regression tests for both zero-based and positive-offset slices. Direct construction matters: DAEProblem has a separate pre-existing operating-point failure for zero-based arrays, which otherwise masks this regression.

Non-blocking findings

  • The PR body lacks the repository-required risk-assessment section. Add it and obtain the counted independent review before merge.
  • Separate partial-array and zero-based operating-point DAEProblem probes fail on clean master too. Those are not PR regressions. Their exact introduction was not established; no fixes or external issues were created during this read-only review.

What I ran

All validation used Julia 1.12.7, the requested TMPDIR, and scratch copies; the checkout remained unchanged.

  • GROUP=InterfaceI JULIA_PKG_PRECOMPILE_AUTO=0 "julia" +1.12 --project="<round dir>/scratch/head/lib/ModelingToolkitBase" -e 'using Pkg; Pkg.instantiate(); Pkg.test(; julia_args=["--threads=1"], allow_reresolve=true)': 1828 passed, 5 broken, 1833 total, exit 0, 52m56.2s.
  • GROUP=QA JULIA_PKG_PRECOMPILE_AUTO=0 "julia" +1.12 --compiled-modules=existing --project="<round dir>/scratch/head/lib/ModelingToolkitBase" -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"], allow_reresolve=true)': JET 54/54; Aqua/QA 21/21, exit 0.
  • "julia" +1.12 --compiled-modules=existing --project="<round dir>/scratch/focused-env" "<round dir>/scratch/focused.jl" "<round dir>/scratch/head/lib/ModelingToolkitBase/test/array_equation_dae.jl": 57/57, exit 0. Repeated with negative-env and the base source: 53 passed, 4 failed, exit 1. Failures reproduce the claimed one-dimensional code-size check (623 == 1631), two multidimensional checks, and sentinel check.
  • Additional residual probes: observations, nonuniform scalar/array mixtures, derivative assertions, and two nonuniform permutations pass. Offset direct-function probes fail as detailed above.
  • Runic --check, changed-file typos, and git diff --check origin/master...HEAD: passed.
  • Read the PR, linked issue, related array-initialization issues, sibling array-ODE work, relevant RFC context, and current failing CI logs.

What I did not verify

Docs build, groups outside InterfaceI/QA, downstream integration suites, other Julia versions, or runtime performance/allocations. I did not establish base equivalence for every failing downstream CI job. This Codex findings review does not supply the independent merge rating.

Links


🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5 (review text by Codex CLI gpt-6.1-sol, local job)
Conversation: https://claude.ai/code/session_0133iSjsLBByPU93BDEQkNDF

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as Chris Rackauckas's account — not written or reviewed by Chris.

The H1 finding reproduces locally: positive offsets give incorrect residuals in both calling modes, and zero-based slices throw BoundsError. The tested local fix limits compact derivative bindings to one-based parent axes and uses scalar expansion for offset axes. The regression file passes 61/61; the full ModelingToolkitBase InterfaceI rerun passes 1832 assertions with five existing broken tests, and QA passes JET 54/54 plus Aqua 21/21. Runic and typos pass.

Publishing is blocked: git push returned HTTP 403, and GitHub reports push: false for the authenticated account, ChrisRackauckas-Claude. The fix is committed locally but has not been pushed; the PR branch and body are unchanged. A repository writer must publish it before another review can inspect the fix.


🤖 Posted by an AI agent — harness: Codex CLI · model: gpt-6.1-sol
Conversation: local fixer job SciML__ModelingToolkit.jl__5121 (no session URL)

Use compact derivative reshapes for parent arrays whose axes start at one.
Test in-place and out-of-place DAEFunction residuals for zero-based and
positive-offset derivative slices.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI
Agent-Model: gpt-6.1-sol
Agent-Session: local fixer job SciML__ModelingToolkit.jl__5121 (no session URL)
@ChrisRackauckas

Copy link
Copy Markdown
Member Author

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Update to the comment above: the fix is now pushed as bbccee36f5, the fixer's local commit applied unchanged onto 0aac06d0d0. The "not pushed" statement there no longer holds. Evidence is in the new section of the PR body.


🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5
Conversation: https://claude.ai/code/session_0133iSjsLBByPU93BDEQkNDF

@xtalax-droid

Copy link
Copy Markdown
Contributor

Measured this branch on the FiniteElementMethod.jl residual form (F ~ apply_op(Mop, D(u)) + apply_op(Kop, u) with opaque registered array operators, then two unknowns, then a nonlinear registered term), counting nodes of DAEFunction(sys; expression = Val{true}), against upstream/master at f2e440c.

variant N master nodes this PR nodes
u only 40 / 400 1023 / 6063 493 / 493
u, w 40 / 400 1745 / 11825 677 / 677
u, w, apply_R 40 / 400 1711 / 11791 643 / 643

Slices passed into a registered call, elementwise use of D(u), and a 2D unknown are also flat in N on this branch. The residual matches the hand-computed value in each case.

Two observations for review:

  • Residual allocation is still linear in N (about 57 B per unknown at N = 400 versus 82 B on master). That comes from the out-of-place registered calls and unfused array arithmetic, not from the du binding, so it is not a defect of this PR.
  • The tests here cover D(x) ~ -x, heat equations and observed forms. None puts D(u) inside a registered array function, which is the FEM form; a node-count-equality test for that case would cover it.

🤖 Posted by an AI agent · harness: Claude Code 2.1.310 · model: claude-sonnet-5-5
Review: unreviewed
Session: de59b94f-0227-49ea-adb5-b158639dad0b

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Contractor review (ai-requests#58) of this PR, copied by the posting agent without change to its findings: reviewer Codex CLI 0.164.0 / gpt-6.1-sol, session 01a18da8-3a3a-7620-b234-342bf3d4309e, reviewed head bbccee3, round 2, verdict CHANGES, risk high.

Risk assessment (independent review, Codex CLI 0.164.0 gpt-6.1-sol, slot 1, head bbccee3)

  • Risk: high (H1: Rejects previously admissible system symbols named __mtk_dae_du; MH1 also applies to the core derivative-codegen representation change.)
  • Verdict: CHANGES
  • Session: 01a18da8-3a3a-7620-b234-342bf3d4309e
  • Blocking priorities: P2

Review round 2, written by the reviewer named above (Codex CLI 0.164.0 / gpt-6.1-sol) 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: Preserves array derivative views to keep implicit residual code size bounded. The complete changed file passes locally, but a residual-valid input on origin/master is rejected by the new reserved sentinel check, confirming the H1 blocker.

Blast radius: Implicit DAE generated residuals, observed derivative expressions, assertions, multidimensional and offset/interleaved layouts.

Evidence: Julia 1.13.2: the full head array_equation_dae.jl passes 61 assertions, including analytic solutions, view/code-size and derivative/Jacobian checks. On origin/master its code-size assertion fails (623 versus 1631 nodes); the head passes it. A separate valid parameter named __mtk_dae_du gives a zero residual on the base (1/1 pass), but the head throws the new reserved-name ArgumentError. G1 analytic residual/solution checks pass and G2 is exercised locally. G3 introduces no shared mutable state; the naming/cache rationale does not waive the H1 input rejection.

Blocking findings

  1. [P2] lib/ModelingToolkitBase/src/systems/codegen.jl:53 — confirmed by running: a system with parameter __mtk_dae_du[1:6] constructs and evaluates a zero residual on origin/master, while the same input throws ArgumentError: the array derivative sentinel __mtk_dae_du collides with a symbol of the system; this name is reserved for internal use on the head. The new source test explicitly enforces that rejection. H1 applies to rejecting formerly valid input even for an unlikely collision. Select a deterministic unused sentinel from the system symbol set, respecting the fixed-name codegen/cache requirement, and require a correct residual for this input rather than reserving a formerly usable name.

Non-blocking findings

None.

What I ran

First-round read-only inspection, retained for this unchanged head. Repository commands below ran in the isolated checkout and exited 0; rev-parse HEAD matched the live head metadata. Base is the fetched target-branch tip at review time, while the three-dot diff uses the merge base. Newest non-merge commit trailers, rather than body attribution, supply AUTHOR_GRADE provenance.

git fetch origin +refs/pull/5121/head:refs/remotes/pr/5121 +refs/heads/master:refs/remotes/origin/master
git checkout --detach pr/5121
git rev-parse HEAD
git rev-parse origin/master
git diff --check origin/master...HEAD
git log -1 --no-merges --format=%B
git diff origin/master...HEAD

Read-only GitHub inspection (PR views exit 0; pr checks exits 1 because failures exist):

gh pr view 5121 --repo SciML/ModelingToolkit.jl --json number,url,state,isDraft,headRefOid,baseRefName,baseRefOid,title,files,commits,statusCheckRollup
gh pr view 5121 --repo SciML/ModelingToolkit.jl --json body,closingIssuesReferences
gh pr checks 5121 --repo SciML/ModelingToolkit.jl
gh issue view 5097 --repo SciML/ModelingToolkit.jl --json number,title,body,state,url
gh run view 39123234899 --repo SciML/ModelingToolkit.jl --log-failed
gh run list --repo SciML/ModelingToolkit.jl --branch master --event push --limit 5 --json databaseId,headSha,conclusion,url,name
gh run view 38950292025 --repo SciML/ModelingToolkit.jl --log-failed
gh run view --repo SciML/ModelingToolkit.jl --job 117663180915 --log

CI check rollup at the captured head: {"FAILURE": 3, "SKIPPED": 3, "SUCCESS": 106}. Log-retrieval exit codes are retrieval status, not test exit codes: successful retrieved jobs report tests passed; failed jobs remain failed. Failed-run logs were retrieved with a writable scratch XDG_CACHE_HOME. Unavailable logs are disclosed above. The recent default-branch five-run listing was also read; exact historical comparisons are identified in the evidence paragraph.

MTKBase InterfaceI CI passed 1832 assertions with 5 existing broken markers; offset-axis and compact-code-size tests are wired into array_equation_dae.jl. Downstream groups pass but IntegrationTest SII and MTK Forward Mode still fail; historical master 38950292025 has the same exception signatures. One failed job log is unavailable. I did not independently reproduce the author/fixer fail-before/pass-after runs.

Inspected CI URLs: https://github.com/SciML/ModelingToolkit.jl/actions/runs/39123234899, https://github.com/SciML/ModelingToolkit.jl/actions/runs/39123235276/job/117663180915, https://github.com/SciML/ModelingToolkit.jl/actions/runs/38950292025.

Round 2 local execution:

All 20 live PRs were checked OPEN with unchanged reviewed heads before Julia execution. Each run checked out the exact detached SHA shown below. Julia 1.13.2 ran directly inside the inherited resource scope, with one Julia invocation at a time, four Julia threads and one BLAS thread. The isolated environment was created with Pkg.activate(temp=true) and Pkg.develop(path=...) for the checkout and its MTKBase subpackage, then persisted outside the checkout for dependency reuse. No test project or source was edited in the checkout.

The driver activates that environment, resolves compatible registered dependencies without updating registries, and includes each selected script in a fresh module. It catches only at the test-file boundary to record every selected result, then exits nonzero if any selected case failed. Assertions and tolerances are unchanged. --compiled-modules=existing reuses available dependency caches and loads uncached PR source; it does not disable tests.

base-master-basecontext-retry: detached 550a27cca63cbe6d7b64bcb2920440aaff9eaa55 (origin/master), process exit 1, 311.21 s.

git -C ModelingToolkit.jl checkout --detach origin/master
REVIEW_CASES='4902,4907,5121,5133,5136,5195,5196,5205,5215' \
JULIA_DEPOT_PATH="$PWD/depot:" JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 \
TMPDIR="$PWD/tmp" JULIA_NUM_PRECOMPILE_TASKS=1 JULIA_PKG_PRECOMPILE_AUTO=0 \
timeout 3600 julia --startup-file=no --compiled-modules=existing --depwarn=yes tmp/rerun/driver.jl

Resolved versions: SymbolicUtils 4.54.0, Symbolics 7.47.0, SciMLBase 3.58.0, JumpProcesses 10.0.1, NonlinearSolve 4.32.0, ModelingToolkit 11.47.0, ModelingToolkitTearing 1.20.7, ModelingToolkitBase 1.79.0, OptimizationBase 5.10.0.

extra-base-checks: detached 550a27cca63cbe6d7b64bcb2920440aaff9eaa55 (origin/master), process exit 1, 323.45 s.

git -C ModelingToolkit.jl checkout --detach origin/master
REVIEW_ENV_DIR=tmp/rerun/env-extra \
REVIEW_CASES='5121-sentinel,5190-scalar-bench,5190-array-helper-bench,5195-noad,5221-oracle,5215' \
JULIA_DEPOT_PATH="$PWD/depot:" JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 \
TMPDIR="$PWD/tmp" JULIA_NUM_PRECOMPILE_TASKS=1 JULIA_PKG_PRECOMPILE_AUTO=0 \
timeout 3600 julia --startup-file=no --compiled-modules=existing --depwarn=yes tmp/rerun/driver.jl

Resolved versions: SymbolicUtils 4.54.0, Symbolics 7.47.0, SciMLBase 3.58.0, JumpProcesses 10.0.1, NonlinearSolve 4.32.0, ModelingToolkit 11.47.0, ModelingToolkitTearing 1.20.7, ModelingToolkitBase 1.79.0, OptimizationBase 5.10.0.

head-5121: detached bbccee36f51493a284e5865822456fe3cb8aaad2 (pr/5121), process exit 1, 177.62 s.

git -C ModelingToolkit.jl checkout --detach pr/5121
REVIEW_CASES='5121,5121-sentinel' \
JULIA_DEPOT_PATH="$PWD/depot:" JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 \
TMPDIR="$PWD/tmp" JULIA_NUM_PRECOMPILE_TASKS=1 JULIA_PKG_PRECOMPILE_AUTO=0 \
timeout 3600 julia --startup-file=no --compiled-modules=existing --depwarn=yes tmp/rerun/driver.jl

Resolved versions: SymbolicUtils 4.54.0, Symbolics 7.47.0, SciMLBase 3.58.0, JumpProcesses 9.33.1, NonlinearSolve 4.32.0, ModelingToolkit 11.45.4, ModelingToolkitTearing 1.20.7, ModelingToolkitBase 1.77.4, OptimizationBase 5.10.0.

Included the complete unchanged head lib/ModelingToolkitBase/test/array_equation_dae.jl. Base stops at the new code-size assertion: six checks pass and one fails, comparing expression-node counts 623 and 1631. Head passes all 61 assertions. The separate sentinel-named-parameter contract passes 1/1 on the base; the head errors before evaluating the residual because of its new guard. The head process exits 1 solely for that independent contract probe, not the submitted file. The extra base batch exits 1 for unrelated later reviewer-probe/context errors; CASE_PASS 5121-sentinel records this case passed.

Exact reviewer script 5121-sentinel.jl:

using ModelingToolkitBase, SciMLBase, Test
@testset "Previously valid sentinel-named parameter" begin
 @independent_variables t
 @variables x(t)[1:6]
 @parameters __mtk_dae_du[1:6]
 D=Differential(t)
 sys=complete(System([D(x) ~ -x .+ __mtk_dae_du],t,collect(x),[__mtk_dae_du];name=:collision_contract))
 prob=DAEProblem(sys,[x=>ones(6),D(x)=>-ones(6),__mtk_dae_du=>zeros(6)],(0.,1.);build_initializeprob=false)
 out=zeros(6);prob.f(out,prob.du0,prob.u0,prob.p,0.)
 @test out == zeros(6)
end

What I did not verify

No whole suite, GPU, Reactant, MPI or exhaustive AD-backend matrix was run. The array residual/code-size file and a concrete former-valid-name contract were executed. Cache reuse across separate native precompile sessions was not benchmarked; deterministic names remain a valid engineering constraint but do not remove the demonstrated SemVer issue. A clean native-precompile cycle was not verified: the initial batch dependency workload errored during NonlinearSolveFirstOrder AD-backend selection. The recorded test commands use existing caches and JIT-load uncached PR source; no assertion was disabled.

🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5
Conversation: https://claude.ai/code/session_01379heiiB35TtywhR7uSU74

ChrisRackauckas and others added 4 commits November 7, 2026 23:57
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__ModelingToolkit.jl__5121 (no session URL)
Select a deterministic name against system symbols, including the independent
variable. Verify colliding parameter names in both residual calling modes.

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__ModelingToolkit.jl__5121 (no session URL)
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__ModelingToolkit.jl__5121 (no session URL)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.170.0
Agent-Model: gpt-6-luna
Agent-Job: SciML__ModelingToolkit.jl__5121--20261121T144046Z-codex-gpt-6-luna
Agent-Session: local session 01a1fe8e-2a47-7301-85c3-3ea111cfd9a0 (no session URL)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-generated Filed by an AI agent needs-chris-review Bot-filed finding awaiting review by ChrisRackauckas

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve array derivatives in implicit DAE residual code generation

3 participants