fix(mpc): cancel superseded replans - #895
Merged
Merged
Conversation
frahlg
marked this pull request as ready for review
August 11, 2026 08:44
This was referenced Aug 11, 2026
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.
What changed
StopcallsWhy
#889 prevents an older solve from publishing over a newer request. It did not stop Core from waiting on that solve or from doing fallback and shadow work after the result became stale. This change gives each accepted generation a service cancel path and closes the Stop/Optimize lifecycle race.
Scope boundary
This cancels Core's request and follow-on work. An active native solve in the Unix optimizer sidecar can still run until its existing solver deadline because the Python worker holds
SOLVE_LOCKwhile solving. Worker-side active-solve supersession remains follow-up work under #885.Verification
go test -race -count=20go test -race ./internal/mpcgo test -race ./internal/api ./cmd/ftwmake verify-all: 117 Python tests, all Go tests, Core to Optimizer contract tests, compose migration, end-to-end tests, vet, builds, and Linux arm64/amd64 plus Windows amd64 cross-buildsRefs #885