Skip to content

fix(state): bound forecast retention scans and pauses - #1553

Merged
frahlg merged 2 commits into
masterfrom
codex/stable-forecast-prune-20261011
Oct 11, 2026
Merged

frahlg merged 2 commits into
masterfrom
codex/stable-forecast-prune-20261011

Conversation

@frahlg

@frahlg frahlg commented Oct 11, 2026

Copy link
Copy Markdown
Member

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_version changes, 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 verify pass. No state schema, Energyplan or driver change. A new beta and real-site trial are still required.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T11:00:24.750657Z e41d38b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@frahlg
frahlg merged commit 748a357 into master Oct 11, 2026
@frahlg
frahlg deleted the codex/stable-forecast-prune-20261011 branch November 11, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant