Port upstream 0.69.0: reset Codex weekly baseline on plan change (stacked on #629) - #690
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 |
|
Reviewed by Codex gpt-6-luna (xhigh); verified and validated by Claude Thermo-nuclear review of PR #690 (Codex weekly baseline reset on plan change): 1 finding.
The rest of the diff (confirmation plan match, baseline reset on a known differing plan, backfill skip on differing known login methods, unknown plans never resetting) matches the spec. No UI change. |
|
Fixes landed at current head 1864c84 The medium finding is fixed; nothing is left open. Commands run: |
|
Reviewed by Codex gpt-6-luna (xhigh); verified and validated by Claude Thermo-nuclear review of PR #690 (Codex plan-change baseline): 1 finding.
|
|
Follow-up: the finding is fixed at the new head (pure move, no behavior change). Nothing left open. Commands run: |
…69.0-codex-plan-change-baseline
Move the plan-change weekly-reset tests into weekly_reset/tests/plan_change.rs so tests.rs stays under 1000 lines after merging #629, and port the upstream CodexPlanTransitionPublicationTests cases that were missing: - a new plan without a weekly window cannot borrow the old plan's window; - the new plan's own usage and reset become the stored baseline at 0 % and 5 %; - same-plan (any case or spacing) or blank-plan near-zero readings keep the old evidence.
Lane B review: fixes at 9ef221dReviewed the full diff against its base Base picked up (20eaf3a). I merged the reviewed #629 head (4a1674e) into this branch. The only conflict was Logic: no defects found. The plan-change reset in These Windows differences are deliberate:
Tests (9ef221d)
Not ported
Validation (Windows, toolchain 1.98.0)
UI proof: not applicable. The change is backend decision logic plus a desktop cache guard with no visible surface of its own. |
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).