Port upstream 0.69.0: reset Codex weekly baseline on plan change (stacked on #629) - #690
Open
Finesssee wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A Codex subscription change (for example Plus to Pro) now starts a new weekly-quota baseline instead of being judged against the previous plan's published weekly window.
initial_decision: when the source is exact OAuth, the observation is newer than the stored one, and both the stored and fresh plans are known and differ (trimmed, case-insensitive), the account state is reset (published weekly, pending candidate, credit inventory).preserve_weeklytherefore no longer pins the previous plan's weekly window.confirmation_decision: a near-zero weekly confirmation now requires the initial and confirmation plans to match (normalized; unknown vs known counts as different). A nonzero confirmation can still publish its own plan.codex_reset_backfill(backfill_slot_window): skipped for Codex when both cached and freshplan_nameare known and differ, so the old plan's reset times are not copied onto the new plan.Stacked on #629 (
weekly_reset.rsand its tests).Upstream reference
CodexWeeklyResetConfirmation.swift(normalizedPlan, plan guard in confirmation),UsageStore+CodexResetBackfill.swift(codexPlanChanged),UsageStore+CodexWeeklyResetConfirmation.swift(plan-change baseline reset),UsageStore+Refresh.swift,Tests/CodexBarTests/CodexPlanTransitionPublicationTests.swift,docs/codex.md.Ported / Deferred
port/micro-0.69.0-codex-auth-publication-retry: credential-file publication retry (item 6a).UsageStore+TokenAccountsmulti-snapshot backfill filter (no equivalent path in the Windows shell; the single cached-snapshot backfill guard covers it).AccountState), so the whole state is reset rather than separate in-memory snapshots.Validation
Cargo run with
+1.98.0, target slot-4, E-core pinned.cargo +1.98.0 fmt --all: cleancargo +1.98.0 clippy --workspace --all-targets -- -D warnings: passcargo +1.98.0 test -p codexbar weekly_reset -- --test-threads=4: 21 passed, 0 failed (7 new)cargo +1.98.0 test -p codexbar providers::codex -- --test-threads=4: 61 passed, 0 failedcargo +1.98.0 test -p codexbar-desktop-tauri backfill -- --test-threads=4: 8 passed, 0 failed (2 new)New fixtures: Plus to Pro upgrade with an 80%-used published weekly (baseline reset, confirmation publishes); same-plan near-zero refresh (baseline kept); unknown/blank/stale/non-OAuth (baseline kept); pending candidate discarded on plan change; near-zero confirmation with a changed or unknown plan preserved; nonzero confirmation publishes its own plan; backfill skipped only when both plans known and differ.
Affected areas
rust/src/providers/codex)commands/providers.rs, values only)Note:
commands/providers.rswas already over 1000 lines (1429); this adds about 52 lines including tests.UI proof
Not applicable (values only; no UI surface changed).