feat: skip memory startup when Codex rate limits are low#19990
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2edff1624b
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
codex/codex-rs/memories/README.md
Lines 31 to 38 in e8f899f
Documented startup behavior is now stale: start.rs adds a rate-limit guard that can skip phase 1/2, but the README still states startup depends only on ephemeral/feature/sub-agent/state-DB checks and then runs both phases. This mismatch can mislead operators when memories.min_rate_limit_remaining_percent causes unexpected skips.
ℹ️ 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".
Why
Memory startup runs in the background after an eligible turn, but it can consume Codex backend quota at exactly the wrong time: when the user is already near a rate-limit boundary. This PR adds a guard so the memory pipeline backs off when the Codex rate-limit snapshot says the remaining budget is too low.
What Changed
memories.min_rate_limit_remaining_percentwith a default of25, clamped to0..=100, and regeneratedcore/config.schema.json.codex-rs/memories/write/src/guard.rs, which fetches Codex backend rate limits before memory startup and skips phase 1 / phase 2 when the Codex limit is reached or either tracked window is above the configured usage ceiling.codex.memory.startupcounter withstatus=skipped_rate_limitwhen startup is skipped.Verification
codex-rs/memories/write/src/guard_tests.rsfor threshold, primary/secondary window, and reached-limit behavior.