Skip to content

Test causal connector direction against input/output metadata - #5298

Draft
ChrisRackauckas-Claude wants to merge 4 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix/causal-connector-test-direction
Draft

ChrisRackauckas-Claude wants to merge 4 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix/causal-connector-test-direction

Conversation

@ChrisRackauckas-Claude

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

Copy link
Copy Markdown
Member

🚧 UNREVIEWED — Ignore this PR until reviewed by @ChrisRackauckas.
🤖 This PR was prepared by an AI agent; Chris has not reviewed it.

InterfaceI fails its causal-connector assertion because it expects output ~ input, while connection expansion produces input ~ output. The assertion now checks that direction and independently verifies that its left side has input metadata and its right side has output metadata. Production code is unchanged. The same assertion fails in the current MTK downstream check on JuliaSymbolics/SymbolicUtils.jl#1169 .

The original causal-connector feature tested this direction; a later test-only edit reversed the expectation while retaining the opposite comment. Correcting sentinel comparisons in #5295 made the stale assertion observable. The added metadata predicates check the contract independently of the observed printed equation. Both predicates are public owner APIs.

Verification

Julia 1.13.2, four threads and precompile tasks, one BLAS/OMP thread. Both runs used the same isolated environment developing this repository and its local sublibraries:

GROUP=InterfaceI julia --startup-file=no --check-bounds=yes --project="$VALIDATION_ENV" -e 'using Pkg; Pkg.test("ModelingToolkitBase")'

Unmodified base 207f39e2d3c63d87e9ecde21279ec6967e4e8b21, exit 1:

ERROR: LoadError: Some tests did not pass: 1802 passed, 1 failed, 0 errored, 5 broken.
InterfaceI | 1802  1  5  1808  35m00.6s

With this exact three-line test change, exit 0:

InterfaceI | 1805  5  1810  27m31.9s
Testing ModelingToolkitBase tests passed

Official QA:

ulimit -n 65536
GROUP=QA julia --startup-file=no --check-bounds=yes --project="$VALIDATION_ENV" -e 'using Pkg; Pkg.test("ModelingToolkitBase")'
JET Tests  | 54  54  51.9s
Aqua Tests | 21  21  5m48.5s
Testing ModelingToolkitBase tests passed

The first QA attempt passed JET 54/54 and reached Aqua 20 pass/1 error, failing with FolderMonitor(start): too many open files (EMFILE). The identical command passed on retry with the child file-descriptor limit above. This does not establish the limit as the cause of the transient failure. No test was disabled or weakened. Runic, spelling over the diff, and whitespace checks passed. Docs, GPU, Everything, and unrelated downstream suites were not run for this test-only change.

CI completed with 99 successful checks, seven failures and three skipped checks. Recorded same-head comparisons match all seven failures to default 207f39e2d3: five Optimization jobs share UnsupportedNonlinearOperator(:literal_pow), downstream indexing shares the one-element-vector state-coordinate BoundsError, and SciMLSensitivity Core8 shares mtk.jl:216's 3600-element interval-vector access at3601. Core8 counts differ (PR208pass/1error versus default205pass/2errors); the classification concerns the shared failure, not identical full-suite results. PR Core8 job, matching default job. Existing investigations and fixes are linked below; their full downstream suites were not rerun with those fixes. No all-green CI claim is made.

Independent review

Fresh Codex CLI 0.163.0 / gpt-6.1-sol reviewer: APPROVE, low risk, high confidence; no blocking findings for exact commit 2c870917f06268e9ac844015e0385657d0588492. The reviewer recorded provisional risk before reading author reports, independently inspected the original feature/source/test history and connector metadata, and reran the exact testset from clean archives with all six local path dependencies relocated.

Julia 1.13.2, clean baseline archive: 1 passed, 1 failed, exit 1
Julia 1.13.2, clean patched archive: 4/4 passed, exit 0

Full InterfaceI/QA were inspected in raw author logs, not independently repeated. The reviewer independently passed diff spelling and whitespace checks; Runic success is author evidence. An existing scalar connect docstring direction discrepancy is outside this test patch and does not change the source/history contract. No runtime bug-fix claim is made.

Reviewer thread: local thread 01a15d51-24f8-7ca2-9cb5-0a6533099a35; outer local session 01a15ca3-5696-7ea3-bbac-ba551b6975af (no session URL exposed).

Links

Risk assessment

  • Risk: low
  • Blast radius: one ModelingToolkitBase testset; no production or public API changes.
  • Evidence: official failing-before/passing-after InterfaceI and passing QA above; fresh clean archived testset failing before/passing after.
  • Independent review: Codex CLI 0.163.0 / gpt-6.1-sol rated low risk, high confidence: independent contract/history checks and clean 1pass/1fail to4pass control; no blocking findings (independent review).
  • Merge: auto-merge candidate once CI introduces no regressions and parent policy is satisfied; this is a test-only change with a clean independent low-risk rating.

🤖 Generated by an AI agent — harness: Codex CLI 0.163.0 · model: gpt-6.1-sol
Author conversation: local session 01a15cac-cfc9-7a93-b5cd-c60ba1c32c71 (no session URL).
Conversation: local session 01a15ca3-5696-7ea3-bbac-ba551b6975af (no session URL exposed).

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

Merged the default branch normally, retaining both parents. Upstream includes the Optimization literal-power repair and the causal-direction correction with expanded connection cases. Resolved the test conflict by preserving those cases and checking input/output metadata in all four port/scalar connection cases. The net diff against incorporated default d6e93c5bbe is two added assertion lines; there are no additional production changes.

All seven reported failures also occur on the original default-branch push at 207f39e2d3. Matching raw signatures are the one-element state-vector bounds error, the 3600-element checkpoint-vector bounds error, and UnsupportedNonlinearOperator(:literal_pow). Their latest default executions succeed. The latest Sublibrary CI matrix was skipped, so that comparison uses the most recent actual Optimization executions.

Validation used Julia 1.13.3, four threads, one precompile task, and one BLAS thread. Full groups use their existing repository entrypoints and resolved scratch environments containing the declared dependencies. Commands below normalize scratch locations to environment variables.

The earlier source-loading attempts did not pass: InterfaceI reported 1730 passes, one subprocess-startup timeout assertion, one Symbolics binding error, and three existing broken tests. Optimization passed its OptimizationSystem and InfiniteOpt testsets, then reported CasADi conversion errors and was stopped after corrupt Conda solver files were identified. Clean-default focused CasADi probes passed, so that conversion error was not established as a default regression. No test was disabled or weakened.

A fresh job-local Python environment was installed from the identical frozen lockfile using a job-local Pixi cache and no hard links. Its Ipopt executable runs successfully; the original zero-byte shared files were untouched. Final full runs below use normal compiled modules and this fresh interpreter:

export JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=1 OPENBLAS_NUM_THREADS=1
export JULIA_CONDAPKG_BACKEND=Null JULIA_PYTHONCALL_EXE="$PYTHON_ENV/bin/python"
export PATH="$PYTHON_ENV/bin:$PATH"

Regression control: original and PR testsets were extracted unchanged from their commits and run against the same merged production source and dependencies. This isolates the test correction; it is not an archived runtime-baseline or new runtime bug-fix claim.

julia +1.13.3 --startup-file=no --compiled-modules=existing --project="$VALIDATION_ENV" "$SCRATCH/causal-before.jl"
julia +1.13.3 --startup-file=no --compiled-modules=existing --project="$VALIDATION_ENV" -e 'include("../scratch/causal-after.jl"); include("../scratch/causal-merged.jl")'

Original assertion, exit 1:

Expression: isequal(eq, comp2.output.u ~ comp1.input.u)
Evaluated: isequal(comp1₊input₊u(t) ~ comp2₊output₊u(t), comp2₊output₊u(t) ~ comp1₊input₊u(t))
Test Summary:                                | Pass  Fail  Total   Time
Causal connections generate causal equations |    1     1      2  30.5s

PR assertions and merged testset, exit 0:

Test Summary:                                | Pass  Total   Time
Causal connections generate causal equations |    4      4  27.7s
Test Summary:                                | Pass  Total  Time
Causal connections generate causal equations |   14     14  0.5s

Full root InterfaceI, exit 0:

GROUP=InterfaceI julia +1.13.3 --startup-file=no --check-bounds=yes --project="$VALIDATION_ENV" test/runtests.jl
Test Summary: | Pass  Broken  Total      Time
InterfaceI    | 1741       3   1744  29m29.8s

Full root Optimization, exit 0:

GROUP=Optimization julia +1.13.3 --startup-file=no --check-bounds=yes --project="$OPTIMIZATION_ENV" -e 'using Test, SafeTestsets; include("test/group_optimization.jl")'
Test Summary:           | Pass  Broken  Total     Time
OptimizationSystem Test |  191       1    192  4m54.4s
Test Summary:              | Pass  Total     Time
InfiniteOpt Extension Test |    5      5  1m48.8s
Test Summary:                            | Pass  Total      Time
Dynamic Optimization Collocation Solvers |  146    146  39m19.4s

QA (unchanged repository QA body), exit 0:

GROUP=QA julia +1.13.3 --startup-file=no --check-bounds=yes --project="$QA_ENV" test/qa/qa.jl
Test Summary:     | Pass  Total  Time
Extensions loaded |    4      4  0.0s
Test Summary:               | Pass  Total     Time
Documented input-output API |   16     16  1m15.0s
Test Summary:     | Pass  Total   Time
Quality Assurance |   20     20  58.5s

Runic, spelling over the net diff, and whitespace checks passed:

julia +1.13.3 --project=@runic -m Runic --inplace lib/ModelingToolkitBase/test/components.jl
git diff upstream/master -- lib/ModelingToolkitBase/test/components.jl > "$SCRATCH/diff.patch"
typos "$SCRATCH/diff.patch"
git diff --check

Separate sublibrary and LTS/prerelease matrix runs, downstream suites, Everything, GPU, and docs were not rerun locally. Downstream classification uses raw CI comparisons, not local downstream verification. Independent review of the merged head is pending.

Whole-repository CI spelling is currently red on four occurrences of the existing ancestor-index variable anc in lib/ModelingToolkitBase/src/atomic_array_dict.jl (553:5, 554:5, 555:33, 555:41). The same four findings reproduce with typos-cli 1.47.0 on clean incorporated default; CI uses 1.50.1. The affected file and spelling configuration are unchanged between the default and this head. No source or ignore rule was changed for this pre-existing finding. Diff-only spelling still exits 0.

cd "$CLEAN_DEFAULT"
typos --format json .
exit 2: four anc -> and findings at the same four positions

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__5298 (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 0462609)

Merged the default branch normally (no rebase, no force push), bringing the branch from the incorporated default at the previous head to current default 11a490d1a2. There are no new production or test edits from this session: the net diff against current default is still only the two assertion lines in lib/ModelingToolkitBase/test/components.jl (isinput(eq.lhs) / isoutput(eq.rhs)).

rack ci compare classes two checks base-green for the previous head: tests / Optimization (julia 1, ubuntu-24.04) and Spell Check with Typos. Every other failing check is classed pre-existing (Extensions, sublibrary QA/Extensions, downgrade Extensions, ModelOrderReduction downstream).

Optimization: the previous-head job was cancelled at the 120-minute timeout, not failed on a test assertion. Its log shows the same Ipopt problem-size sequence as the successful default-branch job at the incorporated default (20 of 23 solves completed, then two silent intervals of 42.5 and 46.8 minutes). The default-branch Optimization (julia 1) job succeeds in 34 minutes at current default and 44 minutes at the incorporated default, and the previous head's Optimization (julia lts) job succeeded in 34 minutes. The net PR diff touches only an InterfaceI test file, so no PR code path can affect the Optimization group. No code change was made for this; the merge refreshes the branch and restarts CI, and the full group passes locally below.

Spell Check: typos reports the same four anc findings in lib/ModelingToolkitBase/src/atomic_array_dict.jl (553:5, 554:5, 555:33, 555:41) on a clean checkout of current default (exit 2, identical positions), and recently merged default-branch PRs show the same spell-check failure. That file and .typos.toml are unchanged between default and this head. No code change was made for this pre-existing finding; diff-only spelling passes.

QA note: root QA now errors on current default as well. Local QA (below) and the current default-branch QA (julia 1) CI job both fail all_qualified_accesses_are_public because expand_record_equations is not public in ModelingToolkitBase but is used qualified from ModelingToolkit (src/systems/systems.jl:13). That name arrived with the default-branch commits merged here; it is not in this PR's net diff. No code change was made for it in this PR.

Validation used Julia 1.13.2, four threads and four precompile tasks, one BLAS thread. Commands below normalize the scratch environment location to an environment variable.

Focused causal testset (same assertions as the merged components.jl testset, including the two added lines), exit 0:

julia --startup-file=no --project="$VALIDATION_ENV" causal_probe.jl
Test Summary:                                | Pass  Total  Time
Causal connections generate causal equations |   14     14  1.9s
CAUSAL_PROBE_DONE

Full root Optimization group, exit 0 (the one broken test is the pre-existing @test_broken already in the group; no test was disabled or weakened):

GROUP=Optimization julia --startup-file=no --project=. -e 'using Pkg; Pkg.test()'
Test Summary: | Pass  Broken  Total      Time
Optimization  |  342       1    343  46m42.9s
     Testing ModelingToolkit tests passed

Root QA group, exit 1 with the pre-existing default-branch error described above (39 pass, 1 error):

GROUP=QA julia --startup-file=no --project=. -e 'using Pkg; Pkg.test()'
NonPublicQualifiedAccessException
Module `ModelingToolkit` has explicit imports of names from modules in which they are not public:
- `expand_record_equations` is not public in `ModelingToolkitBase` but it was imported from `ModelingToolkitBase` at `src/systems/systems.jl:13:32`
Test Summary:                                  | Pass  Error  Total     Time
QA                                             |   39      1     40  2m51.4s

Runic, diff spelling, and whitespace checks, all exit 0:

julia --project=@runic -m Runic --inplace lib/ModelingToolkitBase/test/components.jl
git diff upstream/master > diff.patch
typos diff.patch
git diff --check

Full InterfaceI was not rerun in this session (the focused merged testset above covers this PR's two added lines; full InterfaceI failing-before/passing-after evidence is already in the PR body). Separate sublibrary matrix runs, downstream suites, Everything, GPU, and docs were not rerun locally. CI for the new head was checked once after pushing that it started; its result was not waited for.

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: Muse CLI Code · model: muse-wonder-full-1.0
Conversation: local fixer job SciML__ModelingToolkit.jl__5298 (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 2416ec1)

Merged upstream master at 1feb1ec1db to pick up its anc to ancestor spelling correction. The PR diff against this base is the two assertions for causal connector metadata.

The GitHub job uses Typos 1.50.1. Running typos --format brief . with that version on the old PR head and its incorporated default produced the same four findings and exit 2.

./lib/ModelingToolkitBase/src/atomic_array_dict.jl:553:5: error: `anc` should be `and`
./lib/ModelingToolkitBase/src/atomic_array_dict.jl:554:5: error: `anc` should be `and`
./lib/ModelingToolkitBase/src/atomic_array_dict.jl:555:33: error: `anc` should be `and`
./lib/ModelingToolkitBase/src/atomic_array_dict.jl:555:41: error: `anc` should be `and`

The identical scan on clean current master and on this merge commit exited 0 with no diagnostics. Diff spelling and whitespace checks also exited 0. $SCRATCH denotes the job scratch directory and typos below denotes the CI version.

git diff upstream/master HEAD > "$SCRATCH/net-pr.patch"
typos "$SCRATCH/net-pr.patch"
git diff --check 'HEAD^1' HEAD

Runic on the 32 Julia files in the merge exited 0 with no output or formatting edits. The staged tree matched the committed tree.

git diff --name-only --cached --diff-filter=ACMR -z -- '*.jl' |
  xargs -0 -r julia --project=@runic -m Runic --inplace

Tests used Julia 1.12.4, four threads, and one precompile task.

export JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=1 OPENBLAS_NUM_THREADS=1
ulimit -n 65536
GROUP=QA julia --project -e 'using Pkg; Pkg.test()'
GROUP=InterfaceI julia --project -e 'using Pkg; Pkg.test()'

Full root InterfaceI exited 0.

Test Summary: | Pass  Broken  Total      Time
InterfaceI    | 1784       3   1787  35m38.8s
Testing ModelingToolkit tests passed

Root QA exited 1 with the same six-symbol reexport assertion as the current default-branch job.

No unapproved public reexports: Test Failed
Evaluated: isempty([:Curl, :Divergence, :Grad, :Laplacian, :NormalDerivative, :poissonians])
QA | 39 passed, 1 failed, 40 total

Downstream and sublibrary CI comparisons used existing job logs. Local runtime verification covered the two root groups above.

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 01a20191-dd5f-7883-ba37-c32b2b3dff0f (no session URL)

Check the equation direction against input/output connector metadata.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Codex <noreply@openai.com>
Agent-Harness: Codex CLI 0.163.0
Agent-Model: gpt-6.1-sol
Agent-Session: local session 01a15cac-cfc9-7a93-b5cd-c60ba1c32c71 (no session URL)
ChrisRackauckas and others added 3 commits November 8, 2026 01:03
Retain input/output metadata assertions across the expanded causal connection
cases while incorporating the default branch fixes for the reported CI errors.

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__5298 (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__5298 (no session URL)
Bring in the default branch's ancestor identifier spelling correction.
Keep the causal connector metadata assertions.

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__5298--20261122T044215Z-codex-gpt-6.2-sol
Agent-Session: local session 01a20191-dd5f-7883-ba37-c32b2b3dff0f (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

2 participants