Skip to content

Forward reassemble_alg through generate_control_function - #5260

Open
ChrisRackauckas-Claude wants to merge 7 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix-5255-control-function-options
Open

ChrisRackauckas-Claude wants to merge 7 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix-5255-control-function-options

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Summary

generate_control_function accepted reassemble_alg without error, but the keyword was packaged into Symbolics.CodegenFunctionOptions and never reached the internal mtkcompile call. This change takes reassemble_alg as an explicit keyword (like simplify/split) and forwards it when compiling an unscheduled system, so linear algebraic loops can be eliminated the same way as with a direct mtkcompile(...; reassemble_alg).

Failing before (src stashed)

Test Summary:                                     | Pass  Fail  Error  Total   Time
generate_control_function forwards reassemble_alg |    2     1      1      4  27.8s

Failure: isequal(dvs, [x]) evaluated [x(t), y(t)]; only(f(...)) then errored (multi-element).

Passing after (with fix)

Test Summary:                                     | Pass  Total   Time
generate_control_function forwards reassemble_alg |    4      4  23.5s

Test group / targeted run

Ran the owning test file lib/ModelingToolkitBase/test/input_output_handling.jl via a scratch env that develops this checkout (group InterfaceI owns this file). Exit 0; new testset 4/4. Runic --check and typos on 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 only generate_control_function + its regression test. Fetched failing job logs via gh api .../actions/jobs/<id>/logs, stripped ANSI, and compared signatures to master's recent runs.

Failure class PR jobs Actual error Verdict / evidence
InterfaceI (Julia 1 + lts) sublibrary-ci MTKBase InterfaceI variable_parsing.jl:66 — ArgumentError: Variable x must have default of matching size. Got [1, 2] Pre-existing / Symbolics. Identical on master Sublibrary CI run 37486847188 job 112352183435. Local probe on this PR: same ArgumentError. Untouched by this diff.
Extended (Julia 1 + lts) sublibrary-ci MTKBase Extended ccompile.jl:11 — CTarget with expression=Val{false} is not supported Pre-existing / Symbolics. Identical on master job 112352182552. Local probe: same ArgumentError. Untouched by this diff.
RegressionI (Julia 1 + lts) sublibrary-ci MTKBase RegressionI latexify.jl:68 — ReferenceTests needs JULIA_REFERENCETESTS_UPDATE Pre-existing / reference drift. Identical on master job 112352182774. Untouched by this diff.
Optimization (sublibrary + top-level Tests, Julia 1 + lts; downgrade-mtkbase Optimization) several optimizationsystem.jl:814 AmplNLWriter BoundsError (1-element Vector{Expr} at [2]); :874 iprob.f.cons_expr.exprs === nothing fails Pre-existing. Identical on master Tests run 37488901413 job 112358564208 (same lines/errors). Untouched by this diff.
Benchmarks (lts; 1 cancelled) Benchmarks failed to clone ... GitError(... early EOF) Environmental network/git clone on runner.
SciMLBase.jl/SymbolicIndexingInterface/1/ IntegrationTest SCCNonlinearProblem has no field u0 inside SciMLBase tests Downstream / unrelated to this PR's MTKBase change.

No 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

  • Full GROUP=InterfaceI / Pkg.test() suite for ModelingToolkitBase or the top-level package (CI runs them; failing subsets above are master-shared).
  • Downstream ControlSystemsMTK / named_ss integration beyond the issue's algebraic-loop example.
  • Forwarding of other mtkcompile keywords beyond reassemble_alg.

Reviewer pushback

  • Whether other structural-simplification kwargs should also be peeled out of the codegen kwargs... dump rather than only reassemble_alg.
  • Whether nothing as the default sentinel is preferable to always constructing DefaultReassembleAlgorithm().

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)


🤖 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

🤖 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 be22b3e)

Merged upstream master normally to include the parsing/default-size and Latexify corrections. Resolved both control-function conflicts by preserving reassemble_alg and upstream verbose forwarding. The resulting PR diff remains three files. No failing assertion, import allowlist, shutdown limit, or link-check configuration was changed by this fixer.

Verification

Julia 1.12.4; four Julia threads except the completed ModelingToolkitBase QA run, which used one; one BLAS thread; automatic package precompilation disabled. HEAD_TEST_ENV, BASE_TEST_ENV, BASE_QA_ENV, BASE_PROJECT, REGRESSION, and BASELINE_QA_CASE below denote the recorded isolated environments, clean upstream sublibrary project, and verbatim extraction of the committed regression testset. These variables omit machine-specific locations.

julia --project=@runic -m Runic --inplace lib/ModelingToolkitBase/src/inputoutput.jl lib/ModelingToolkitBase/src/systems/codegen_compat.jl lib/ModelingToolkitBase/test/input_output_handling.jl
git diff upstream/master -- lib/ModelingToolkitBase/src/inputoutput.jl lib/ModelingToolkitBase/src/systems/codegen_compat.jl lib/ModelingToolkitBase/test/input_output_handling.jl | typos -
git diff --cached --check

All three commands exited 0, with no diagnostics.

The same control-function testset discriminates between clean upstream source and the merged source:

timeout 3600 julia --compiled-modules=existing -O0 --project="$BASE_TEST_ENV" "$REGRESSION"
timeout 3600 julia --compiled-modules=existing -O0 --project="$HEAD_TEST_ENV" "$REGRESSION"

Before, exit 1:

Test Summary:                                     | Pass  Fail  Error  Total     Time
generate_control_function forwards reassemble_alg |    2     1      1      4  1m19.4s

After, exit 0:

Test Summary:                                     | Pass  Total     Time
generate_control_function forwards reassemble_alg |    4      4  1m27.8s

The old parsing file reproduced ArgumentError: Variable x must have default of matching size. Got [1, 2] with size (2,) (17 passed, 1 errored); the merged file passed 48/48. The old tracked Latexify reference errored at latexify.jl:68; the merged tracked reference passed 1/1. These probes included the existing files in separate testsets with the same pinned dependencies. ReferenceTests generated four missing untracked fixtures; those artifacts were removed and are excluded from this change.

Full owning groups:

GROUP=InterfaceI timeout 7200 julia --compiled-modules=existing --project -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing"])'
GROUP=InterfaceI timeout 7200 julia --compiled-modules=existing -O0 --project=lib/ModelingToolkitBase -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing", "-O0"])'
GROUP=RegressionI timeout 7200 julia --compiled-modules=existing -O0 --project=lib/ModelingToolkitBase -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing", "-O0"])'
GROUP=InterfaceI timeout 3600 julia --compiled-modules=existing -O0 --project="$BASE_PROJECT" -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing", "-O0"])'

Observed tails:

# Root InterfaceI, exit 0
InterfaceI    | 1743       3   1746  46m02.4s
Testing ModelingToolkit tests passed

# Sublibrary InterfaceI, exit 1
InterfaceI | 2125  1  5  2131  17m27.8s

# Clean upstream sublibrary InterfaceI, exit 1
InterfaceI | 2125  1  5  2131  20m01.2s

# Sublibrary RegressionI, exit 0
Latexify recipes Test | 1  1  56.2s
Testing ModelingToolkitBase tests passed

The sole InterfaceI failure is identical on clean upstream: symbolic_events.jl:1929 returns [2.9999999999999982, 4.0, 6.0] where the test expects [1.0, 3.0, 1.0]. A narrowed baseline reproduction passed four assertions and failed that one: its numerical event is at 0.9999999999999996, before the query 1 - eps() == 0.9999999999999998. The test therefore observes the post-affect state. No event code or assertion was changed.

QA commands used the existing official runners with a populated test environment stacked on LOAD_PATH, avoiding the extra Pkg.test launcher around Aqua's child processes:

GROUP=QA JULIA_NUM_THREADS=4 JULIA_LOAD_PATH="@:$HEAD_TEST_ENV:@stdlib" timeout 7200 julia --compiled-modules=existing -O0 --project="$HEAD_TEST_ENV" test/runtests.jl
GROUP=QA JULIA_NUM_THREADS=1 JULIA_LOAD_PATH="@:$HEAD_TEST_ENV:@stdlib" timeout 7200 julia --compiled-modules=existing -O0 --project="$HEAD_TEST_ENV" -e 'cd("lib/ModelingToolkitBase/test"); include("runtests.jl")'

Root QA exited 1: 39 passed, 1 failed, only Aqua's unchanged 60-second persistent-task check. Sublibrary QA exited 1: standalone JET tests 54/54; Aqua/combined QA 19 passed, 1 failed, 1 errored. Its failures are the same shutdown check and five qualified non-public dependency accesses. The exact five-name import error also appears in the default-branch QA job linked below.

An isolated clean-upstream probe ran the same qualified-public-access check with the unchanged repository allowlist, and Aqua.test_persistent_tasks for both packages at the unchanged tmax = 60, through the same SciMLTesting.with_clean_persistent_tasks_sources wrapper:

timeout 3600 julia --compiled-modules=existing -O0 --project="$BASE_QA_ENV" "$BASELINE_QA_CASE"
Test Summary:                   | Fail  Error  Total      Time
Clean upstream QA failures      |    2      1      3  11m24.8s
  Qualified accesses are public |           1      1      8.2s
  ModelingToolkit               |    1             1   7m19.8s
  ModelingToolkitBase           |    1             1   3m56.8s

The full strict documentation command was run twice:

timeout 3600 julia --compiled-modules=existing -O0 --project=docs docs/make.jl

Both runs exited 1 solely at [:linkcheck], after the doctest and document-check phases. GitHub returned HTTP 429 for the ColPrac README on the first run and the PDEBase interface page on the second. Both links are unchanged on upstream. A direct HEAD retry for ColPrac from the clean checkout returned HTTP 200. Rendering remains unverified; no link exemptions or warning-only settings were added.

The original SciMLBase indexing failure is corrected upstream by the linked SciMLBase change; its latest inspected master job passes. No downstream integration rerun, complete Everything suite, GPU suite, or additional local Julia-version matrix is claimed. CI startup was checked once for this exact new head: 58 checks were in progress, 1 queued, and 22 completed. Final CI results were not 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__5260 (no session URL)

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

Fix by Muse CLI Code muse-wonder-full-1.0 (head 20f5bdc)

What changed:

  • Merged upstream master (11a490d1a2, 12 commits) into the PR branch with a normal merge, bringing in current master changes (including the QA ReinterpretArray allowance). No conflicts; the PR diff against master is unchanged apart from the item below.
  • Renamed the local variable anc to ancestor in record_ancestor_value in lib/ModelingToolkitBase/src/atomic_array_dict.jl (3 lines). This fixes the base-green Spell Check with Typos failure (anc should be and at lines 553-555).

CI triage (rack ci compare on head be22b3e): only two checks were classed base-green — Spell Check with Typos (fixed above) and downgrade-mtkbase (Optimization). The Optimization job failure on the PR was a 6 h GitHub timeout cancellation while Ipopt was iterating (##[error]The operation was canceled, iteration 170), with ~80-minute gaps between iterations on the shared runner. The same job on current upstream master succeeded (Testing ModelingToolkitBase tests passed). The PR diff does not touch optimization code, so no code change was made for it; this push re-runs it on current master. All other red checks were classed pre-existing (Extensions precompile errors, QA ExplicitImports, ModelOrderReduction downstream).

Validation (Julia 1.13.2, JULIA_NUM_THREADS=4):

  • typos lib/ModelingToolkitBase/src/atomic_array_dict.jl before the rename: 4 errors, exit 2; after: exit 0. typos . on the whole tree after: no errors.
  • julia --project=@runic -m Runic --inplace lib/ModelingToolkitBase/src/atomic_array_dict.jl: exit 0, no changes.
  • Targeted tests in a scratch environment developing this checkout, including the owning files the way the top-level test harness does:
    Test Summary:     | Pass  Total   Time
    Input Output Test |  125    125  51.6s
    Test Summary:         | Pass  Total     Time
    Struct Variables Test |  111    111  1m11.1s
    
    The PR regression testset alone also passed 4/4.
  • GROUP=QA julia --project=lib/ModelingToolkitBase -e 'using Pkg; Pkg.test()': 20 passed, 1 errored — the same pre-existing ExplicitImports all_qualified_accesses_are_public error classed pre-existing by rack ci compare (non-public Symbolics/SymbolicUtils qualified accesses in files this PR does not touch). No code change made for it.

Not verified: the downgrade Optimization group locally (multi-hour; it re-runs in CI on this push), and the full test suite.

Next counted review must come from a smart model in a fresh session, not this fix session (risk.md § Independent reviews).

🤖 Posted by an AI agent — harness: Muse CLI Code · model: muse-wonder-full-1.0
Conversation: local fixer job SciML__ModelingToolkit.jl__5260 (no session URL)

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

Fix by Claude Code 2.1.326 claude-sonnet-5-5 (head 9b48693)

No source change was needed: the PR's own code is unchanged. The failing tests / QA and lib/ModelingToolkitBase [QA] checks on the old head were caused by a stale base (expand_record_equations was not declared @public in ModelingToolkitBase, which upstream master has since fixed). I merged upstream/master into the branch (a normal merge, no force-push) so the PR picks up that fix.

Validation run locally on the merged head:

  • julia --project=@runic -m Runic --check and typos over the three changed files: both exit 0.
  • GROUP=InterfaceII in lib/ModelingToolkitBase: 4279 passed, 1 failed. The single failure is Proper substitution in JumpSysMajParamWrapper (jumpsystem.jl:598, a @test_nowarn hit by a JumpProcesses deprecation warning). It also fails on upstream master's own SublibraryCI run, and the PR does not touch jump code. The PR's new generate_control_function forwards reassemble_alg testset passes.
  • GROUP=QA in lib/ModelingToolkitBase: 20 passed, 1 failed. The failure is No unapproved public reexports (:Curl, :Divergence, :Grad, :Laplacian, :NormalDerivative). The identical failure reproduces on a clean checkout of upstream master, so it is pre-existing.

Not reproduced locally: Catalyst/Simulation/1 (FieldError on a JumpProcesses internal, dep_gr, in Catalyst's own test) and downgrade-mtkbase (Optimization) (6 h timeout). Neither touches code this PR changes; both need a fresh CI run on the new head.

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


🤖 Posted by an AI agent — harness: Claude Code 2.1.326 · model: claude-sonnet-5-5
Conversation: local fixer job SciML__ModelingToolkit.jl__5260 (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.2-sol (head abf1b04)

The standalone structural compiler now rejects explicit reassemble_alg values with an ArgumentError. The full compiler exposes the documented ModelingToolkit.default_reassemble_algorithm constructor for linear SCC inlining and the symbolic solve size limit. The control-function test exercises both compiler paths, and symbolic linearization uses the same constructor.

The reported downgrade Optimization cancellation also occurred on default-branch runs. Both logs ended during the same Ipopt solve with 15,994 equality-Jacobian nonzeros and zero failing assertions. The latest default-branch job passed. The full local downgrade group passed and the corresponding Ipopt solve reported 27.863 seconds and EXIT: Optimal Solution Found.

Validation

The environment variables below stand for the tested scratch checkouts, their test launchers, and the verified Julia 1.10.13 executable. The standalone InterfaceI and both QA invocations loaded the official test runner inside the Pkg.test sandbox to fit the Julia process limit. The regression launcher extracted the same testset from the test file for both checkouts.

julia --project=@runic -m Runic --inplace \
  lib/ModelingToolkitBase/src/inputoutput.jl lib/ModelingToolkitBase/src/systems/systems.jl \
  lib/ModelingToolkitBase/test/input_output_handling.jl src/ModelingToolkit.jl \
  src/linearization.jl src/systems/systemstructure.jl
git diff --cached | typos -
git diff --cached --check

timeout 3600 julia --startup-file=no --compiled-modules=existing -O0 \
  --project="$BEFORE_ENV" "$REGRESSION_RUNNER" "$CONTROL_TEST"
timeout 3600 julia --startup-file=no --compiled-modules=existing -O0 \
  --project="$AFTER_ENV" "$REGRESSION_RUNNER" "$CONTROL_TEST"

GROUP=InterfaceI timeout 7200 julia --startup-file=no --compiled-modules=existing -O0 \
  --project -e 'using Pkg; Pkg.test(; julia_args=["--compiled-modules=existing", "-O0"])'
(cd "$BASE_PROJECT" && GROUP=InterfaceI timeout 7200 julia --startup-file=no \
  --compiled-modules=existing -O0 --project "$GROUP_RUNNER")
timeout 3600 julia --startup-file=no --compiled-modules=existing -O0 \
  --project "$LINEARIZE_RUNNER"

(cd "$ROOT_PROJECT" && GROUP=QA timeout 7200 julia --startup-file=no \
  --compiled-modules=existing -O0 --project "$GROUP_RUNNER")
(cd "$BASE_PROJECT" && GROUP=QA timeout 7200 julia --startup-file=no \
  --compiled-modules=existing -O0 --project "$GROUP_RUNNER")

timeout 3600 julia +1.10.12 --startup-file=no "$DOWNGRADE_ACTION" \
  "$CI_SKIP" lib/ModelingToolkitBase alldeps 1.10 ''
(cd "$DOWNGRADE_BASE_PROJECT" && timeout 7200 "$JULIA_1_10_13" --startup-file=no \
  --compiled-modules=yes --check-bounds=yes --depwarn=yes --project=test/optimization \
  -e 'using Pkg; Pkg.precompile()')
(cd "$DOWNGRADE_BASE_PROJECT" && GROUP=Optimization timeout 10800 "$JULIA_1_10_13" \
  --startup-file=no --compiled-modules=yes --check-bounds=yes --depwarn=yes --project \
  -e 'using Pkg; Pkg.test(; julia_args=["--check-bounds=yes", "--compiled-modules=yes", "--depwarn=yes"], force_latest_compatible_version=false, allow_reresolve=false)')

timeout 7200 julia --startup-file=no --compiled-modules=existing -O0 --project=docs docs/make.jl

Runic, typos, and the whitespace check exited 0. Regression before (exit 1) and after (exit 0):

No exception thrown
UndefVarError: `default_reassemble_algorithm` not defined in `ModelingToolkit`
Control-function compiler selection | Fail 1 | Error 1 | Total 2

Control-function compiler selection |    5      5  3m30.5s
# Full ModelingToolkit InterfaceI
InterfaceI    | 1779       3   1782  20m43.6s
Testing ModelingToolkit tests passed

# Full standalone ModelingToolkitBase InterfaceI
InterfaceI    | 2205       5   2210  17m59.3s
Test runner completed

# Targeted symbolic linearization
Linearization Tests |   99       1    100  4m06.6s

# Full downgrade Optimization
OptimizationSystem Test |  185       1    186  4m27.8s
MultiObjective Optimization |   35     35  3.0s
InfiniteOpt Extension Test |    5      5  52.9s
Dynamic Optimization Collocation Solvers |  117    117  17m47.2s
Testing ModelingToolkitBase tests passed

Both QA runs exited 1. Root QA reported 38 passed and 2 failed. Standalone QA reported 54/54 JET assertions and 19 passed and 2 failed in Aqua and combined QA. Each failure was either unexpected dependency reexports reproduced in default-branch CI or Aqua's 60-second shutdown check reproduced by the clean-upstream probe in the earlier fix section. Both packages passed ExplicitImports and public API documentation checks.

Both strict docs attempts reached CrossReferences and CheckDocument and then exited 1 with makedocs encountered an error [:linkcheck] -- terminating build before rendering. GitHub returned HTTP 429 for the existing NEWS link on the first run and the existing PDEBase link on the second. Individual HTTP requests returned 200 for both links. HTML rendering and the complete CI matrix remain unverified.

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

Links


🤖 Posted by an AI agent — harness: Codex CLI 0.170.0 · model: gpt-6.2-sol
Conversation: local session 01a20195-b8e0-7f10-b77d-5f4c62331ed5 (no session URL)

ChrisRackauckas and others added 2 commits October 7, 2026 12:07
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
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

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

Independent review (Codex CLI 0.166.0 / gpt-6.1-sol), session 01a19702-1d86-7fd0-be36-12396f48d45e, reviewed head 36b63ae

  • Verdict: MERGE
  • Risk: low (L8: the new optional reassemble_alg keyword preserves defaults and is documented and tested; the failing-before/passing-after regression also verifies the reported bug.)
  • Round / slot: 1 / 1
  • Blocking priorities: none

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: Forwards the optional reassemble_alg keyword from generate_control_function to compilation of unscheduled systems while preserving the default call. The regression fails on the merge-base and passes on the exact requested head; no blocking defect was found.

Blast radius: The keyword compatibility wrapper and GeneratedFunctionOptions overload of generate_control_function in ModelingToolkitBase. Only unscheduled systems with an explicit non-nothing algorithm take the new compilation branch; the implementation of mtkcompile and its default algorithm are unchanged.

Evidence: Blind risk sealed in INITIAL.md and INITIAL.sha256 before author context. Julia 1.13.2 owning input/output file: head exit 0, new regression 4/4; the same head test file with merge-base package sources: exit 1, new regression 2 passed, 1 failed, 1 errored. Analytically, y=3(x+u)/8, z=(x+u)/8 and dx=(3u-5x)/8, so the expected -0.25 at x=u=1 is independent of generated output. A third probe exited 1 before assertions because my explicit eval_module=Main lacked RuntimeGeneratedFunctions initialization; no numerical-grid or ForwardDiff result is claimed. Top-level InterfaceI checks passed on stable, LTS, prerelease and x86; six other checks failed, with the comparisons described below.

Blocking findings

None.

Non-blocking findings

None.

What I ran

Commands below use SHARED_DEPOT for the configured shared depot to avoid recording machine-specific paths. All Julia commands ran serially with four Julia threads, one OpenBLAS thread, an isolated temporary directory, automatic package precompilation disabled, and a 3600-second timeout.

gh pr view 5260 --repo SciML/ModelingToolkit.jl --json number,url,state,isDraft,headRefOid,baseRefName,baseRefOid
git -C src fetch origin '+refs/pull/5260/head:refs/remotes/pr/5260' master
git -C src checkout --detach pr/5260
git -C src fetch origin '+refs/heads/master:refs/remotes/origin/master'
git -C src rev-parse HEAD origin/master
git -C src merge-base origin/master HEAD
git -C src diff origin/master...HEAD
sha256sum INITIAL.md > INITIAL.sha256
gh pr view 5260 --repo SciML/ModelingToolkit.jl --json title,body,commits,statusCheckRollup,headRefOid,baseRefOid
gh issue view 5255 --repo SciML/ModelingToolkit.jl
gh pr checks 5260 --repo SciML/ModelingToolkit.jl
gh run list --repo SciML/ModelingToolkit.jl --branch master --event push --limit 5
git -C src log -1 --no-merges --format=%B bf209c9c2b761da61774a46c421ef179d99cfd2e..HEAD
git -C src worktree add --detach ../base bf209c9c2b761da61774a46c421ef179d99cfd2e
JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 JULIA_PKG_PRECOMPILE_AUTO=0 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$SHARED_DEPOT:" timeout 3600 julia +1.13.2 --startup-file=no --compiled-modules=existing -O0 head-test.jl
JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 JULIA_PKG_PRECOMPILE_AUTO=0 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$SHARED_DEPOT:" timeout 3600 julia +1.13.2 --startup-file=no --compiled-modules=existing -O0 base-test.jl
JULIA_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 JULIA_PKG_PRECOMPILE_AUTO=0 TMPDIR="$PWD/tmp" JULIA_DEPOT_PATH="$SHARED_DEPOT:" timeout 3600 julia +1.13.2 --startup-file=no --compiled-modules=existing -O0 adversarial.jl

Git, metadata and issue reads succeeded; gh pr checks returned 1 for failing checks. The API-advertised Base above is also the merge-base; fetched master was 6613036. Reviewed head equals the live headRefOid and the target head.

The head script activated a separate environment and instantiated with update_registry=false and allow_autoprecomp=false. It loaded the checkout's ModelingToolkit and ModelingToolkitBase and included lib/ModelingToolkitBase/test/input_output_handling.jl in the same import context as test/shared/mtktestset.jl: using ModelingToolkit; import ModelingToolkitBase. Direct test dependencies were ModelingToolkit, ModelingToolkitBase, ModelingToolkitStandardLibrary, NonlinearSolve, Symbolics, SymbolicIndexingInterface and Test. Resolved versions included Symbolics 7.48.0, SymbolicUtils 4.54.0, ModelingToolkitTearing 1.20.7 and ModelingToolkitStandardLibrary 2.29.9. The base environment retained those dependency versions and redirected both local packages to the clean merge-base worktree; package-directory assertions checked this. Both runs reported Julia 1.13.2.

Head exit 0; the owning file completed, including:

Test Summary:                                     | Pass  Total
generate_control_function forwards reassemble_alg |    4      4

Base exit 1; the new test failed at lib/ModelingToolkitBase/test/input_output_handling.jl:508 with dvs=[x(t), y(t)] instead of [x(t)]. The numerical assertion at line 509 errored with "Collection has multiple elements, must contain exactly 1 element":

Test Summary:                                     | Pass  Fail  Error  Total
generate_control_function forwards reassemble_alg |    2     1      1      4

The base inclusion stopped at that failed testset; later testsets were not executed on base.

The third and final Julia invocation attempted an independent 2-by-2 linear-system solve as the reference over a 4-by-4 state/input grid, in-place/out-of-place generation, both split settings, direct GeneratedFunctionOptions calls, default/scheduled behavior, and ForwardDiff derivatives. It exited 1 before any assertion, in its first generation call, because my script explicitly selected eval_module=Main without initializing RuntimeGeneratedFunctions there. The output was:

You must use `RuntimeGeneratedFunctions.init(@__MODULE__)` at module
 top level before using runtime generated functions in Main
Test Summary:                                                    | Error  Total
independent linear-system reference; keyword and options methods |     1      1

This is a reviewer-harness limitation, not evidence of a defect in the changed forwarding logic. No rerun was made; exactly three Julia invocations were used. The independent analytic derivation and executed PR regression above remain the numerical evidence.

CI logs were fetched with gh run view RUN_ID --repo SciML/ModelingToolkit.jl --log-failed, using a writable XDG_CACHE_HOME after the default cache location was denied. Successful InterfaceI jobs and all six failing checks were inspected:

  • The owning top-level InterfaceI run passed; all four InterfaceI platform/version jobs are green. The conditional new regression is wired into this group by test/group_interfacei.jl:4 and test/shared/mtktestset.jl:5.
  • The PR integration failure is two BoundsErrors indexing a one-element Vector{Float64} with [1,2], at downstream comprehensive_indexing.jl:127 and :164. Those exact failures also appear in current master integration logs.
  • PR documentation failed external link checking after curl timed out with exit 28. The exact external-link timeout and final [:linkcheck] error also appear in historical master documentation logs. The most recent completed documentation build inspected was successful at run 41199303325; the newer run was cancelled.
  • The four PR sublibrary failures are variable_parsing.jl:66 rejecting a mismatched array default, and latexify.jl:68 reporting reference-image differences, each on stable and LTS. These files are untouched, and the reassembly regression is gated out in the sublibrary-only harness. Base Sublibrary CI and latest master Sublibrary CI are green; I did not establish identical failures on master for these four jobs. A historical failed sublibrary run 38894707737 had an initialization failure whose log was unavailable; it is not used as matching evidence.

The new keyword's docstring is rendered through the existing docs/src/API/codegen.md:28 entry. No dependency, exported-name, shared-state, threading or default-numerics change was found.

What I did not verify

The third probe did not reach its reference-grid, in-place, split=false, explicit-options, default/scheduled comparison or ForwardDiff assertions because of the stated RGF initialization omission. I did not run full package, downstream, documentation or platform suites, or the real thermal-network/ControlSystemsMTK integration. GPU, MPI, Reactant, Enzyme, Mooncake, Zygote and ChainRules paths were not independently run; this diff changes none of those kernels or AD rules, so G2 does not introduce an additional unexercised changed path. I did not reproduce the old sublibrary parsing and Latexify failures locally or establish matching failures on master. The base owning-file run stopped at the expected regression failure, leaving its later testsets unexecuted.

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

@ChrisRackauckas-Claude
ChrisRackauckas-Claude marked this pull request as ready for review November 2, 2026 02:02
ChrisRackauckas and others added 4 commits November 8, 2026 01:43
Preserve reassemble_alg and verbose forwarding through both control-function
entry points while bringing in the upstream parsing and Latexify test fixes.

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__5260 (no session URL)
…function-options

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Muse <noreply@meta.com>
Agent-Harness: Muse CLI Code
Agent-Model: muse-wonder-full-1.0
Agent-Session: local fixer job SciML__ModelingToolkit.jl__5260 (no session URL)
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Muse <noreply@meta.com>
Agent-Harness: Muse CLI Code
Agent-Model: muse-wonder-full-1.0
Agent-Session: local fixer job SciML__ModelingToolkit.jl__5260 (no session URL)
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

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

PR: #5260

Reviewed head: 9b48693
Raw SHA-256: 04272428af4e0ca405c44f5d309c03de7e5239b634e5988ebc02df3438fa8e64
Source SHA-256: ed0f0de962e106ef8fd5009ef5358a98f316f90f38126c738f38dae8618889fa
Source: standard-review-v1 (harness-log)
Reviewer session: 01a1f3cb-3c44-7210-b664-bab3e6c2694e
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: low (L8)
  • Verdict: CHANGES
  • Reviewed head: 9b48693

Review report

VERDICT: CHANGES
Round: 2
Head: 9b48693
Slot: 1
CI: CI is not green
Session: 01a1f3cb-3c44-7210-b664-bab3e6c2694e
Reviewer: codex-cli 0.170.0; model: gpt-6.2-sol

Risk

low (L8: optional control code generation keyword that preserves the default call)

Blocking findings

  • [P2] lib/ModelingToolkitBase/src/inputoutput.jl:296 — Standalone ModelingToolkitBase silently discards the requested algorithm. With ModelingToolkit absent, the default, a valid inlining configuration, and :invalid all returned identical equations and the same three states [x(t), z(t), y(t)]. The valid configuration reduced the same system to [x(t)] with ModelingToolkit loaded. The standalone compiler accepts the forwarded keyword through kwargs... and never reads it. Document the compiler requirement, reject explicit algorithm values when the active compiler cannot apply them, and cover that case in the standalone tests.

  • [P2] lib/ModelingToolkitBase/test/input_output_handling.jl:498 — The documented option's only demonstrated constructor is private. Julia returned false from Base.ispublic for DefaultReassembleAlgorithm in both its owning module, ModelingToolkitTearing, and the StructuralTransformations alias used by the regression. Provide a documented public way to select the algorithm and use it in the regression.

  • Blocking priorities: P2, P2

Non-blocking findings

None.

What I ran

  • julia --version reported Julia 1.12.4. The head and merge-base scratch manifests matched after normalizing local source paths.
  • julia --startup-file=no --project=../scratch/head-env ../scratch/targeted_suite.jl . ran the affected input/output suite through the root test macro and passed 138/138. The standalone runner, julia --startup-file=no --project=../scratch/head-env ../scratch/standalone_suite.jl ., passed 131/131.
  • I ran julia --startup-file=no --project=../scratch/base-env ../scratch/exact_regression.jl and repeated it with --project=../scratch/head-env. At the merge base, it had 2 passes, 1 failure and 1 error. The generated function retained [x(t), y(t)] and only reported multiple elements. Head passed 4/4. Eliminating the algebraic variables gives the independent derivative 3(x + u)/8 - x.
  • julia --startup-file=no --project=../scratch/probe-env ../scratch/probe.jl full passed 50/50 across both overloads, split and unsplit parameters, scheduled systems, in-place and out-of-place dynamics, invalid algorithm rejection, and an implicit DAE with a known disturbance. The standalone probe had 1 pass and 2 failures, confirming the silent fallback described above.
  • Julia Runic in check mode, typos on the changed files, and git diff --check origin/master...HEAD exited 0.
  • uv run --locked python --version reported Python 3.13.13 and warned that --locked has no effect outside a project. The checkout has no Python lockfile.

What I did not verify

The full test matrix, documentation build, downstream analysis-point calls, and CI logs were outside the targeted runs.

AUTHOR_GRADE: {"task":"bugfix","score":3,"difficulty":2,"rounds":2,"author_harness":"unknown","author_model":"unknown","note":"The regression distinguishes the full compiler fix from the merge base. The standalone compiler silently discards the option, and the test relies on a private constructor."}

Head link: 9b48693


🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-sol
Conversation: local session 01a1f3cb-3c44-7210-b664-bab3e6c2694e (no session URL)

Provide a documented constructor for the full compiler's default reassembly
algorithm. Reject explicit selections in the standalone structural compiler
and cover both compiler paths in the control-function regression.

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.2-sol
Agent-Job: SciML__ModelingToolkit.jl__5260--20261122T044616Z-codex-gpt-6.2-sol
Agent-Session: local session 01a20195-b8e0-7f10-b77d-5f4c62331ed5 (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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generate_control_function does not pass options of the structural simplification (reassemble_alg) to mtkcompile

2 participants