Repository navigation
fix(state): bound forecast retention scans and pauses - #1553
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…st-prune-20261011
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.
Forecast retention rescans the roughly 64,000 retained records before every 64-row delete. It also spends 100 ms between batches, so 30 pauses alone consume the scoring pass’s three-second deadline. The covering index in v0.140.4-beta.1 does not remove either cost.
Read the oldest bounded suffix and retain the budget on one connection. Refresh it when that connection’s
data_versionchanges, and keep SQLite snapshot upgrades as the guard against writes during selection. Delete at most 64 rows per transaction and yield for 10 ms. Preserve expiry, row and byte limits, deterministic ties and resumable committed batches.Validation: the same local fixture with 4,096 excess rows went from two three-second timeouts plus a third attempt to one 823 ms pass. A 16,384-row overflow now completes in two attempts; the original remained above budget after five. These are local fixtures, not proof of the overnight box incident. New tests cover the scoring deadline and concurrent inserts/deletes both between batches and inside a snapshot. Existing tie, byte, expiry and resume tests plus
make verifypass. No state schema, Energyplan or driver change. A new beta and real-site trial are still required.