fix(codex): retain Spark quota on partial header updates - #4008
Conversation
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe quota cache now preserves previously stored custom windows when partial updates omit them. Explicit lists still replace the stored value. Regression tests cover preservation, replacement, empty lists, and account cache clearing. ChangesQuota preservation
Priority: ➖ Normal — Impact reflects medium issue severity. Estimated code review effort: 2 (Simple) | ~10 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Partial quota-header updates now retain existing Spark custom windows, while explicit replacements, clearing, and account-cache resets continue to work. No current merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This PR stays in draft until every box above is ticked. Hygiene✅ Deterministic PR hygiene checks passed. |
|
@coderabbitai review Please review the partial quota merge fix and the regression sequence on the current head. The test reproduced missing Spark custom windows before the fix. Explicit replacement, empty-list clearing, and account-cache clearing are covered. This remains draft while broader verification is pending. |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- PR diff stat ---'
git diff --stat HEAD^ HEAD
echo
echo '--- Changed files ---'
git diff --name-only HEAD^ HEAD
echo
echo '--- Diff ---'
git diff --unified=80 HEAD^ HEAD
echo
echo '--- Candidate quota/cache files ---'
fd -t f . | rg -i '(codex|quota|spark|account|cache)'Length of output: 87442 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- quota module outline ---'
ast-grep outline src/codex/quota.ts --items all --view expanded
echo
echo '--- merge helpers and public update/clear APIs ---'
rg -n -A35 -B12 \
'function (mergeAccountQuota|snapshotHasCustom|snapshotHasUsage)|export function (setAccountQuotaFromParsed|applyAccountQuotaFromUpstreamHeaders|clearAccountQuota|getAccountQuota)' \
src/codex/quota.ts
echo
echo '--- quota types ---'
ast-grep outline src/codex/quota-types.ts --items all --view expanded
cat -n src/codex/quota-types.ts
echo
echo '--- merge call sites and custom-window consumers ---'
rg -n -A5 -B5 \
'\bmergeAccountQuota\s*\(|\bcustomWindows\b' \
src tests/codex-integration/codex-spark-visibility.test.ts tests/codex-integration/main-quota-provenance.test.ts tests/codex-integration/main-quota-evidence-validation.test.ts
echo
echo '--- focused test outline ---'
ast-grep outline tests/codex-integration/codex-quota-parser-parity.test.ts --items all --view expandedLength of output: 78495 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '--- quota update, hydration, and WHAM parsing ---'
sed -n '492,625p' src/codex/quota.ts
sed -n '703,825p' src/codex/quota.ts
echo
echo '--- quota disk shape validation ---'
sed -n '540,611p' src/codex/quota.ts
echo
echo '--- changed regression tests with line numbers ---'
cat -n tests/codex-integration/codex-quota-parser-parity.test.ts | sed -n '1,82p'
echo
echo '--- existing Spark quota parse tests ---'
rg -n -A24 -B12 \
'Spark|GPT-5\.3-Codex-Spark|additional_rate_limits|customWindows' \
tests/codex-integration/codex-quota-parser-parity.test.ts \
tests/codex-integration/codex-spark-visibility.test.ts
echo
echo '--- diff whitespace and worktree status ---'
git diff --check HEAD^ HEAD
git status --shortLength of output: 43674
The regression coverage in
The static review also confirmed that stored custom windows feed quota observation and capacity paths. Retaining them prevents the header update from removing usable Spark quota state.
✅ Action performedReview finished.
|
리뷰 · 우선순위 74 / 80이 PR은 지금 고치는 코드는 한 갈래입니다. 라인 경로 테스트 경로 게이트 - PR이 아직 draft이고 Review readiness checklist가 비어 있습니다. 경로 인접 PR - 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
…rage, history) (#4051) * fix(codex): keep Spark five-hour quota model-scoped Carried from #4018 (author cb8010d6) for maintainer-side CI and sequential integration. Closes #4017 Co-authored-by: cb8010d6 <53855466+cb8010d6@users.noreply.github.com> * fix(codex): retain Spark quota on partial header updates Carried from #4008 (author cb8010d6) for maintainer-side CI and sequential integration. Closes #4007 Co-authored-by: cb8010d6 <53855466+cb8010d6@users.noreply.github.com> * fix(codex): invalidate app-server observations at catalog boundaries Carried from #3981 (author yansigit) for maintainer-side CI and sequential integration. Co-authored-by: yansigit <44089734+yansigit@users.noreply.github.com> * fix(web-search): stop inactivity timing after terminal events Carried from #3979 (author yansigit) for maintainer-side CI and sequential integration. Co-authored-by: yansigit <44089734+yansigit@users.noreply.github.com> * fix(responses): strip Muse web_search fields on direct Meta Carried from #3964 (author ildunari) for maintainer-side CI and sequential integration. Co-authored-by: ildunari <95185577+ildunari@users.noreply.github.com> * fix: preserve combo capabilities and skip referenced archives Carried from #3863 (author x3M3x) for maintainer-side CI and sequential integration. Co-authored-by: x3M3x <98298256+x3M3x@users.noreply.github.com> * fix(codex): recover ocx1-compacted threads for native replay Carried from #3920 (author cb8010d6) for maintainer-side CI and sequential integration. Closes #3916 Co-authored-by: cb8010d6 <53855466+cb8010d6@users.noreply.github.com> --------- Co-authored-by: t <a@b.com> Co-authored-by: cb8010d6 <53855466+cb8010d6@users.noreply.github.com> Co-authored-by: yansigit <44089734+yansigit@users.noreply.github.com> Co-authored-by: ildunari <95185577+ildunari@users.noreply.github.com> Co-authored-by: x3M3x <98298256+x3M3x@users.noreply.github.com>
|
Landed on Verification at the merged head Closing this PR because the change is already on |
Summary
Closes #4007.
After refreshing Spark quota, an ordinary Codex response-header update drops the stored Spark weekly window because those headers omit
customWindows. Retain the previous custom windows when the update omits them. Explicit replacements (including an empty array) and account-cache clearing keep their existing behavior.The runtime change is limited to the partial-snapshot merge; it does not change quota parsing, account selection, authentication, or display settings. Regression coverage exercises the actual WHAM parse -> store -> response-header update sequence, replacement with zero usage, explicit clearing, and account-cache clearing.
Verification
customWindowsbecameundefined.codex-quota-parser-parity,codex-spark-visibility,main-quota-evidence-validation, andmain-quota-provenance.bun run typecheck: passed.bun run privacy:scan: passed.git diff --check: passed.bun run test:changed: selected 821 of 1,145 files and exceeded the runner's 900-second limit (exit 124). The run also reported individual test timeouts, including API-key management tests. Those failures have not been attributed or compared against an unmodified base; this is not an all-green result. The explicitly invoked repository-wide suite has not been run, and this PR remains draft.Checklist
Review readiness checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.