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 |
…tests - Compare the unused rolling weekly offset at full timestamp precision, like upstream's floating-point |boundary - capturedAt - 604800| < 120 check; the seconds-truncated version rejected resets 119.x s short of one week. - Split delayed-candidate revalidation into a pure evaluation that returns the decision and its fixed reason code, and report a missing current credit inventory as missingCreditInventory instead of changedCreditInventory. - Port the upstream rejection table (plan mismatch, changed and missing credit inventory, non-exact source) with reason codes, the confirmed observation reason, and the persisted relaunch test for fixed and rolling boundaries through the StateFile envelope.
Lane B review: fixes at 4a1674eReviewed the full diff against Defects fixed (4a1674e)
Upstream tests ported
Not ported: the upstream Validation (Windows, toolchain 1.98.0)
UI proof: not applicable (backend decision logic only). #690 is stacked on this branch; I will merge this head into it next. |
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.
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:window_minutes == Some(10080);resets_atis 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
Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift(evaluateDelayedCandidate,unusedWeeklyWindows), tests inTests/CodexBarTests/CodexWeeklyResetDiagnosticsTests.swift(unused weekly boundaries advancing with observation time confirm on later refreshes),docs/codex.md.Ported / Deferred
unusedWeeklyWindowsrelaxation and the upstream test matrix (rolling positive at 180/300/900 s offsets, ordinary publication unchanged, nonzero usage, wrong boundary, plan/inventory guards).initialDecisionrestructuring 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.resets_at, upstream publishes above 1% used, while localinitial_decisionpreserves becauseis_valid_boundaryfails first.num_seconds()), consistent with the existing 120 s checks in this module.Validation
Toolchain pinned
cargo +1.98.0, process-localCARGO_TARGET_DIR.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: 14 passed, 0 failedcargo +1.98.0 test -p codexbar providers::codex: 54 passed, 0 failedNew 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
UI proof
Not applicable. No UI surface is touched.