fix: cancel stale allocation closes, let deliberate ones stick#1244
Closed
MoonBoi9001 wants to merge 3 commits into
Closed
Conversation
A close queued under an opt-out rule now cancels at execution time when that rule has since flipped back to allocate, and the after-close never-stamp only steps aside for exactly those stale closes; manual, health-check, and threshold closes stick again as they used to.
A close in deploying state is leftover from a crashed executor run and its transaction may already be on-chain; marking it canceled would record the opposite of what happened. The stale-close check now requires approved status, so deploying closes run to completion.
Filtering the batch scanned a list of canceled ids once per action; a set lookup avoids the repeated scans.
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.
This PR makes allocation-close handling aware of why and by whom a close was queued: a close that no longer reflects the operator's rules is canceled, while a deliberate close still executes and stays closed.
Background: when an indexing rule opts a deployment out (decision basis
neveroroffchain), the indexer agent queues a close for its allocation and, after closing, writes aneverrule so it does not immediately reallocate. A queued close can wait long enough for the operator to flip the rule back to allocate, and before this change it executed anyway.The change has 2 parts:
neverstamp when a rule requests allocation now applies only to agent-queued closes. Closes queued by hand through the CLI or management API write theneverrule unconditionally, so a deliberate close sticks instead of being reopened.The rule lookup also falls back to the global rule now, so a global
alwaysrule counts as requesting allocation. Stacked on #1242, which introduced the after-close rule check.