Skip to content

fix: prune expired state history - #34

Merged
IceCodeNew merged 1 commit into
masterfrom
codex/prune-state-history
Jul 16, 2026
Merged

fix: prune expired state history#34
IceCodeNew merged 1 commit into
masterfrom
codex/prune-state-history

Conversation

@IceCodeNew

Copy link
Copy Markdown
Owner

Summary

  • prune processed articles, published briefings, and context snapshots outside HISTORY_HOURS
  • prune warnings outside their independent WARNING_RETENTION_HOURS
  • run cleanup only after a successful task, in the same transaction as task-health reset
  • preserve records exactly on each retention boundary and leave pending articles and upsert health state untouched

Why

The append-only history tables retained full article, briefing, and context bodies indefinitely. Long-running daemon instances therefore accumulated unbounded SQLite state even though application reads only use configured history windows.

Impact

Successful tasks now keep persisted history aligned with the windows already used by the service. Failed tasks retain existing history, and unpublished pending articles are never pruned by this cleanup.

Validation

  • prek run --all-files
  • uv run --with pytest --with pytest-cov -- pytest --cov --cov-branch --cov-report=xml
  • 482 tests passed; line coverage 99.70%, branch coverage 98.33%

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@IceCodeNew, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 20 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 633960d3-b1da-4158-8faf-55395b3ddd5b

📥 Commits

Reviewing files that changed from the base of the PR and between 8107b4d and 6545203.

📒 Files selected for processing (4)
  • docs/design.md
  • tests/test_state.py
  • weather_briefing/service.py
  • weather_briefing/state.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/prune-state-history

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@IceCodeNew
IceCodeNew requested a review from Copilot July 16, 2026 06:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.51%. Comparing base (8107b4d) to head (6545203).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #34   +/-   ##
=======================================
  Coverage   99.51%   99.51%           
=======================================
  Files          39       39           
  Lines        5728     5761   +33     
  Branches      329      329           
=======================================
+ Hits         5700     5733   +33     
  Misses         17       17           
  Partials       11       11           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@IceCodeNew
IceCodeNew marked this pull request as ready for review July 16, 2026 06:45
@IceCodeNew

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@IceCodeNew
IceCodeNew merged commit 3b57fcf into master Jul 16, 2026
20 checks passed
@IceCodeNew
IceCodeNew deleted the codex/prune-state-history branch July 16, 2026 07:41
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.

2 participants