Repository navigation
fix(quota): bound snapshot persistence under sustained updates - #7666
Conversation
Preserve idle debouncing while bounding scheduled deferral with a monotonic clock. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
Bounded write deferral src/codex/quota.ts, src/providers/account-quota-disk.ts |
Both persistence paths track when a pending write begins. Repeated updates defer the write for no more than one second, while retaining the 250 ms debounce. Clearing all Codex quotas and cancelling provider persistence reset the pending interval. |
Persistence tests and documentation tests/codex-integration/codex-quota-persistence.test.ts, tests/providers/provider-account-quota-persistence.test.ts, scripts/test-layout/layout-codex-collision.json, tests/fixtures/test-layout-expected.json, structure/quota-snapshots.md, structure/INDEX.md, structure/manifest.json |
Tests cover debounce deadlines, sustained updates, clearing or cancelling pending writes, home changes, and failed writes. The structure documents describe the persistence behavior and its tests; the layout files register the Codex persistence test. |
Bun test-runner version
| Layer / File(s) | Summary |
|---|---|
Runner pin and role validation package.json, tests/test-layout-tooling.test.ts, tests/ci-workflows/install-scripts.test.ts, tests/ci-workflows/ci-scope-gaps.test.ts, .github/actions/setup-project-bun/action.yml, .github/workflows/ci.yml, CONTRIBUTING.md, Dockerfile, docs-site/src/content/docs/contributing.md, structure/runtime.md |
The testRunnerBun pin changes to 1.4.4. Tests cover matching and differing caller versions and a mismatched override. Comments and documentation describe independent runtime and test-runner validation and require a successful full cross-platform lane=all run on the exact candidate head for promotion. |
Buffered upload early-response test
| Layer / File(s) | Summary |
|---|---|
Early-response fixture and assertion tests/claude-integration/claude-picker-upload.test.ts |
The fixture adds a half-open TLS server mode that records whether an early reply was flushed before the request body completed. The buffered-upload test uses this mode and checks that condition. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Possibly related issues
lidge-jun/opencodex#7587— This change bounds quota snapshot write deferral and preserves the latest snapshot. It does not implement the issue’s alternate-route or desktop transport design.
Possibly related PRs
- lidge-jun/opencodex#7627 — Shares the Bun 1.4.4 test-runner transition and related role-validation updates.
- lidge-jun/opencodex#7683 — Shares the Bun runner pin, CI comments, and runner tests.
- lidge-jun/opencodex#7420 — Shares the Bun runner transition and buffered-upload test fixture changes.
Merge Risk: 
Minimal · up to 2f767
-
No concrete issue identified here blocks merging; the documented cross-platform promotion check remains a separate readiness step.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title "fix(quota): bound snapshot persistence under sustained updates" matches the main change. The PR adds a one-second maximum deferral to the 250 ms debounce for Codex and provider quota snapshot writes (src/codex/quota.ts and src/providers/account-quota-disk.ts), so sustained updates no longer postpone writes indefinitely. The rest of the changeset (Bun 1.4.3 to 1.4.4 pin updates, CI and docs comments, layout map entries) is supporting or unrelated housekeeping that the title does not need to cover.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 8 files. (12 skipped: 12 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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 @coderabbitai help to get the list of available commands.
|
✅ Deterministic PR hygiene checks passed. |
…rsist-starvation # Conflicts: # tests/claude-integration/claude-picker-upload.test.ts
|
Integration evidence (owner decision decision:b607a677, approved): after #7627 landed the maintainer merged origin/dev into this branch, leaving only this PR's own change (quota snapshot persistence (src/codex/quota.ts, src/providers/account-quota-disk.ts)); independent gpt-6.1-sol review PASS at exact head b8cf17b. Exact-head PR CI run 40156518426 and exact-head ci.yml lane=all run 40156837380 (maintainer mirror branch at this SHA) both succeeded. Static merge simulation on current dev 323a5e1 (this Mac): dev=323a5e11772c38c15b271d23c7696c5947bb97da base=323a5e11772c38c15b271d23c7696c5947bb97da pr_files= 9 overlap=[]; merge clean; install exit=0; gui install exit=0; tsc exit=0; tsc doctor exit=0; structure:check exit=0; privacy:scan exit=0; layout+ratchet guards exit=0 54 pass 0 fail ; Merged by the triage manager as maintainer integration (MAINTAINERS.md, dev only) with green exact-head PR CI, an independent review PASS, and the owner's approval of this bundle. |
Summary
Prevent sustained quota observations from indefinitely postponing snapshot writes. Both Codex and provider writers retain the 250 ms idle debounce and add a one-second maximum scheduled delay measured with a monotonic clock. Each write snapshots the latest state; account removal, cancellation, home changes and write failures preserve the correct pending deadline.
Identity checks, quota calculations, snapshot format and atomic replacement are unchanged. The bound applies to scheduling, not event-loop latency or crash durability. Source commit:
c938424b8d84e2a27756ff6198d512594ffef37b.Verification
2f7674987d32e5991a4fe82826d60e1d4258e75cnormally merges thedevbaseline and shared chore(test): align Bun runner with the 1.4.4 security baseline #7627. Runtime and test runner both use Bun 1.4.4. Thedevcomparison is nine quota/registration/documentation files plus eleven shared transition files.CI=true bun test --isolate --timeout 60000, fresh processes forcodex-quota-persistence.test.tsandprovider-account-quota-persistence.test.ts: 18 passed / 0 failed / 46 assertions.cicheck. The skipped jobs do not establish native Windows/macOS matrix execution.enforce-targetand metadata checks, maintainer review and any required security acceptance are tracked separately before merge. If the still-unmerged chore(test): align Bun runner with the 1.4.4 security baseline #7627 runner transition is introduced ahead of its parent, its exact-candidate full cross-platform promotion proof remains required; the PR CI result above does not supply that proof.Checklist
Co-authored-by: luvs01 27862058+luvs01@users.noreply.github.com
Summary by CodeRabbit
Bug Fixes
Chores
Tests