Skip to content

Port upstream 0.65.0: confirm unused rolling weekly Codex resets - #629

Open
Finesssee wants to merge 1 commit into
port/upstream-0.65.0from
port/micro-0.65.0-codex-weekly-reset-rolling
Open

Finesssee wants to merge 1 commit into
port/upstream-0.65.0from
port/micro-0.65.0-codex-weekly-reset-rolling

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Summary

Codex delayed weekly-reset confirmation now also accepts an unused rolling weekly window. When the provider advances the weekly reset date with each zero-use observation, the candidate and current boundaries differ by more than 120 s across normal refresh intervals. Previously that pair was discarded as InconsistentResetBoundary, so stale pre-reset usage persisted.

In delayed_candidate_decision (rust/src/providers/codex/weekly_reset.rs), boundaries more than 120 s apart are accepted only when all of these hold:

  • candidate and current weekly windows are both exactly 0% used;
  • both have window_minutes == Some(10080);
  • each resets_at is within 120 s of its own capture time + 604800 s (candidate.snapshot_updated_at, current.updated_at);
  • current_boundary >= candidate_boundary.

The equivalent-boundary rule (< 120 s apart) is unchanged. Every other guard is unchanged: exact OAuth, plan match, unchanged credit inventory, 60 s minimum age, 30 min expiry, supported_delayed_boundary, and the threshold checks.

Upstream reference

Ported / Deferred

  • Ported: the unusedWeeklyWindows relaxation and the upstream test matrix (rolling positive at 180/300/900 s offsets, ordinary publication unchanged, nonzero usage, wrong boundary, plan/inventory guards).
  • Not ported: the initialDecision restructuring in the same upstream commit (behavior-preserving), and the Swift persistence/UsageStore test (persisted stale baseline recovers ... rollingBoundary), which exercises Swift store plumbing with no Windows counterpart.
  • Known pre-existing difference, unchanged here: with no published baseline and a weekly window without resets_at, upstream publishes above 1% used, while local initial_decision preserves because is_valid_boundary fails first.
  • Rounding: upstream compares fractional seconds; local compares whole seconds (num_seconds()), consistent with the existing 120 s checks in this module.

Validation

Toolchain pinned cargo +1.98.0, process-local CARGO_TARGET_DIR.

  • cargo +1.98.0 fmt --all: clean
  • cargo +1.98.0 clippy --workspace --all-targets -- -D warnings: pass
  • cargo +1.98.0 test -p codexbar weekly_reset: 14 passed, 0 failed
  • cargo +1.98.0 test -p codexbar providers::codex: 54 passed, 0 failed

New tests: positive rolling case (180/300/900 s), minimum age still applies, ordinary publication unchanged; negatives for nonzero usage (current and candidate), wrong window minutes (current and candidate), boundary not near capture+7d (current and candidate), current boundary earlier than candidate, changed credit inventory, expired candidate.

Affected areas

  • Provider logic (Codex weekly-reset confirmation)
  • Settings / UI / tray / float bar
  • CLI, docs, CI

UI proof

Not applicable. No UI surface is touched.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: ad47cb83-f0cc-48ba-aaaa-b44814d39b75

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

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