Repository navigation
Fix #1726: bound finished envelope outbox retention - #4710
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 32 minutes. View limit details
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. |
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
1 open issue
What changed in this PR
Bounds finished outbox retention to the newest 100 entries (by finish order) and compacts journals on replay when old finished entries are dropped, preserving pending retry state and finish ordering.
Changes:
- Add runtime retention logic for finished entries using a finish-order queue with eviction.
- Add journal compaction on open after replay drops old finished entries (snapshot rewrite + atomic rename).
- Add tests covering runtime retention, replay compaction behavior, and directory deliveries output.
| File | Description |
|---|---|
| pkgs/id/src/envelope_outbox.rs | Implements capped retention + replay-time journal compaction and adds focused tests. |
| pkgs/id/src/directory_view.rs | Adds a regression test ensuring deliveries reflect capped finished history while keeping pending entries. |
Review effort: Lite
|
🤖 Agent note · picked up — escalation reviewed, proceeding
On the standing Plan: merge current |
…x-retention # Conflicts: # pkgs/id/src/envelope_outbox.rs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 097adce7fd
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if destination.exists() { | ||
| fs::remove_file(destination)?; | ||
| } | ||
| fs::rename(temporary, destination) |
There was a problem hiding this comment.
Preserve the journal during Windows compaction replacement
On Windows, reopening a journal with more than 100 finished entries runs this replacement even when pending deliveries remain. If the process crashes after remove_file succeeds but before the rename, or the rename fails, the durable journal is gone and only .compact.tmp remains. The next Outbox::open treats the missing journal as an empty queue and never recovers the temporary file, silently losing acknowledged pending envelopes and artifacts. Use an atomic replacement or a recoverable replacement protocol rather than deleting the original first.
Useful? React with 👍 / 👎.

Summary
Fixes #1726
Tests
cargo test --manifest-path pkgs/id/Cargo.toml --lib envelope_outboxcargo test --manifest-path pkgs/id/Cargo.toml --lib envelope_netcargo test --manifest-path pkgs/id/Cargo.toml --lib directory_view::tests::deliveries_keeps_the_newest_finished_entries_and_all_pending_entriesrustfmt --checkandgit diff --checkOpen in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.