Repository navigation
Restore original state order for SCC steady-state solutions - #175
ChrisRackauckas-Claude wants to merge 2 commits into
Conversation
Reconstruct the result with the original problem's symbolic state mapping when solving a lowered steady-state problem. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Codex <noreply@openai.com> Agent-Harness: Codex CLI 0.157.1 Agent-Model: gpt-6-luna Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/jobs/fix-SteadyStateDiffEq.jl-171/log.txt on amdci2.julia.csail.mit.edu
Recompute sol.resid from the original SteadyStateProblem after remapping u, and apply save_idxs post-restore. Raise ModelingToolkit test compat to 11.45 (empty-SCC schedule fix from MTK #5163 / v11.45.0). Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <cursoragent@cursor.com> Agent-Harness: Cursor Agent CLI Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/jobs/fix-SteadyStateDiffEq.jl-171/log.txt on amdci2.julia.csail.mit.edu
Independent review (Devin CLI 3000.11.3, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium): CHANGES, risk medium. Full reviewVERDICT: CHANGES The core fix works. I ran it, and on MTK-built problems Blocking findings
Non-blocking findings
What I ranAll runs used Julia 1.11 in
What I did not verify
🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (review), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium |
Hold: Chris's direction (2026-10-14) is to replace the post-solve reversal with an SCC form of 🤖 Posted by an AI agent — harness: Claude Code 2.1.285 · model: claude-opus-5-5 |
SCC-lowered
SteadyStateProblemsolves rebuildsol.uin the original unknown order viavariable_symbols, recomputesol.residfrom the original residual at thatu(the lowering's residual can be empty or shorter when states are observed/eliminated — remapping alone cannot recover eliminated residuals), and applysave_idxsafter that restore. ModelingToolkit test compat is raised to11.45(true minimum 11.45.0: MTK #5163's empty-SCC schedule fix; Downgrade CI failed on 11.44.0 withSCCDecomposition(...; combine_sccs)wheneq_sccswasVector{Any}).Failing before (src unfixed, resid/
save_idxsassertions):Passing after:
Validation: focused
test/scc.jlrun (before/after with src stashed); Runic on changed files;typos;git diff --check.Not verified: full
GROUP=CorePkg.test after this follow-up; docs; downstream; Downgrade CI re-run on the new floor.Reviewer pushback: confirm recomputing resid from
prob.f(vs attempting to permute the lowering resid) is the right contract; non-loweredsolve(...; save_idxs=...)still ignoressave_idxs(only the SCC restore path applies it).Fixes #171
Please ignore this draft until reviewed by @ChrisRackauckas.
Risk assessment
sol.uis reconstructed in the original state order (via SymbolicIndexingInterfacevariable_symbols),sol.residis recomputed from the originalprob.fat the restoredu, andsave_idxsis applied after the restore. Plain (non-MTK) SteadyStateProblems give identical results to base. The test-only MTK compat floor is raised to 11.45; 11.45.0 is the first release with Fixsolve(::SteadyStateProblem)regressions from the deferred SCC lowering ModelingToolkit.jl#5163combine_sccssupport. No public API change.sol.ucomes back reversed and the chain and mix cases throw DimensionMismatch. On the PR,sol.u,sol[x]andresidmatch the non-lowered solve for all three, andsave_idxs=[2]returns only element 2. All 13 CI checks are green, including Downgrade, which resolves MTK 11.45.0.SSRootfind(NewtonRaphson())on the chain system throws a ForwardDiff chunk-size error on base too; that's not caused by this PR.Risk assessment and review coordination by 🤖 Claude Code (model: claude-opus-5-5[1m]), https://claude.ai/code/session_01NdFVhANTF4nepTbqYxjfRP
Risk assessment (independent review, Codex gpt-6.1-sol, head 680dcc2)
git diff origin/HEAD...HEAD, algorithm docstrings, relevant solution-indexing implementation, and current CI metadata. All 13 reported checks are successful, so there is no failing CI check requiring a default-branch comparison. Ran the PR's new 20-assertion testset unchanged in scratch copies: head 20 passed; default branch471a4a039f637459ff8625cc832f20a7b85f4f497 passed, 7 failed, 6 errored. Ran an additional symbolic-indexing probe: default branch 4 passed; head 2 passed, 2 failed, with both algorithm variants swapping symbolic values. The two passing head assertions independently check the analytic LV equilibrium[u,v] = [3,1.5]. Julia 1.12.4; ModelingToolkit 11.45.4; ModelingToolkitBase 1.77.4; SciMLBase 3.58.0; NonlinearSolve 4.32.0.git diff --check origin/HEAD...HEADpassed, and finalgit status --porcelainwas empty. G1 pass: analytic equilibrium checks and comparison with the monolithic, non-lowered solve provide independent numerical evidence. G2 not applicable: no GPU kernel, AD rule, Reactant tracing or MPI implementation changes. G3 not applicable: no shared-state/cache/threading/default change is introduced by this diff.Targeted commands run (S denotes
<local path>):All used
JULIA_NUM_THREADS=4,JULIA_PKG_PRECOMPILE_AUTO=0,TMPDIR="$S/tmp", andJULIA_DEPOT_PATH=<local path>. The third script runs the same adversarial probe followed by the same extracted PR testset; its nonzero exit is the expected unfixed regression failure. Scratch copies came fromgit archive HEADandgit archive origin/HEAD, with identical dependency versions and only the developed SteadyStateDiffEq source path differing.🤖 Posted by an AI agent — harness: Codex CLI 0.162.1 · model: gpt-6.1-sol
Conversation: local headless review run (no public session URL); transcript kept by the fleet master.