Repository navigation
Forward reassemble_alg through generate_control_function - #5260
Draft
ChrisRackauckas-Claude wants to merge 2 commits into
Draft
ChrisRackauckas-Claude wants to merge 2 commits into
ChrisRackauckas-Claude wants to merge 2 commits into
Conversation
Previously the keyword was accepted via kwargs but swallowed by CodegenFunctionOptions, so linear algebraic loops were not eliminated. 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/jobs/fix-ModelingToolkit.jl-5255/log.txt on amdci2.julia.csail.mit.edu
This branch has not been deployed
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.
Summary
generate_control_functionacceptedreassemble_algwithout error, but the keyword was packaged intoSymbolics.CodegenFunctionOptionsand never reached the internalmtkcompilecall. This change takesreassemble_algas an explicit keyword (likesimplify/split) and forwards it when compiling an unscheduled system, so linear algebraic loops can be eliminated the same way as with a directmtkcompile(...; reassemble_alg).Failing before (src stashed)
Failure:
isequal(dvs, [x])evaluated[x(t), y(t)];only(f(...))then errored (multi-element).Passing after (with fix)
Test group / targeted run
Ran the owning test file
lib/ModelingToolkitBase/test/input_output_handling.jlvia a scratch env that develops this checkout (groupInterfaceIowns this file). Exit 0; new testset 4/4. Runic--checkandtyposon the three touched files: exit 0.CI triage (PR vs master; not caused by this PR)
Branch is 0 commits behind
master(fd0cbadb43). Diff touches onlygenerate_control_function+ its regression test. Fetched failing job logs viagh api .../actions/jobs/<id>/logs, stripped ANSI, and compared signatures to master's recent runs.variable_parsing.jl:66—ArgumentError: Variable x must have default of matching size. Got [1, 2]37486847188job112352183435. Local probe on this PR: same ArgumentError. Untouched by this diff.ccompile.jl:11—CTarget with expression=Val{false} is not supported112352182552. Local probe: same ArgumentError. Untouched by this diff.latexify.jl:68— ReferenceTests needsJULIA_REFERENCETESTS_UPDATE112352182774. Untouched by this diff.optimizationsystem.jl:814AmplNLWriterBoundsError(1-elementVector{Expr}at[2]);:874iprob.f.cons_expr.exprs === nothingfails37488901413job112358564208(same lines/errors). Untouched by this diff.failed to clone ... GitError(... early EOF)SCCNonlinearProblem has no field u0inside SciMLBase testsNo PR-caused CI failure found; no additional code change. Our regression reconfirmed locally after triage: 4/4 pass.
Opus review: MERGE, low risk (
reviews/opus-1007-5260/REVIEW.md).What I did NOT verify
GROUP=InterfaceI/Pkg.test()suite for ModelingToolkitBase or the top-level package (CI runs them; failing subsets above are master-shared).named_ssintegration beyond the issue's algebraic-loop example.mtkcompilekeywords beyondreassemble_alg.Reviewer pushback
kwargs...dump rather than onlyreassemble_alg.nothingas the default sentinel is preferable to always constructingDefaultReassembleAlgorithm().Fixes #5255
Please ignore this draft until reviewed by @ChrisRackauckas.
Risk assessment
pending independent review
🤖 Generated with Cursor Agent CLI 2026.10.01-14929f9 (model: auto), transcript /log.txt
Risk assessment (independent review, Claude Code 2.1.301 claude-opus-5-5, reviewed head 36b63ae)
ModelingToolkitBase.generate_control_function(both thecodegen_compat.jlkwargs method and theinputoutput.jlmethod) gain areassemble_alg = nothingkeyword that is forwarded tomtkcompileonly when non-nothingand only whensysis unscheduled. Default path is byte-for-byte the old call. Analysis-point overloads forwardkwargs...to the same method, so they pick it up too. Additive public keyword (minor-level API addition, not breaking). No new deps.36b63ae2d8f54472c3ac1ec19b61e5e61db7c544. The new testset is gated on@isdefined(ModelingToolkit), so I raninput_output_handling.jlthe way MTK's@mtktestsetdoes (module withusing ModelingToolkit; import ModelingToolkitBase), Julia 1.13: PR source 125/125 pass; withlib/ModelingToolkitBase/srcfrom master (5abac29) 123 pass, 1 fail, 1 error —isequal(dvs, [x])evaluated[x(t), y(t)]vs[x(t)]and thef(...) ≈ -0.25call errors. Fail-before / pass-after confirmed, matching generate_control_function does not pass options of the structural simplification (reassemble_alg) to mtkcompile #5255. CI: roottests / InterfaceI(1, lts, pre, x86) green (https://github.com/SciML/ModelingToolkit.jl/actions/runs/38850879641/job/116819175941), which is where the gated test runs. The 6 reds are pre-existing: sublibrary InterfaceI "Parsing Test" / RegressionI "Latexify recipes Test" under Symbolics 7.45 (https://github.com/SciML/ModelingToolkit.jl/actions/runs/38850879594/job/116818385387), fixed on master by Update MTKBase tests and compat floors for Symbolics 7.43-7.45 #5281; DocsbuildandSciMLBase.jl/SymbolicIndexingInterfaceintegration also fail on master (https://github.com/SciML/ModelingToolkit.jl/actions/runs/38856355754, https://github.com/SciML/ModelingToolkit.jl/actions/runs/38856355740).mtkcompile, default path unchanged, regression verified locally.🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5 (independent reviewer; appended by Claude Code 2.1.301 · claude-opus-5-5)
Conversation: https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq