Skip to content

feat(quota): add reset-confirmed limit warm-up#773

Closed
mahirozdin wants to merge 1 commit into
Soju06:mainfrom
mahirozdin:feature/add-limit-warmup-trigger
Closed

feat(quota): add reset-confirmed limit warm-up#773
mahirozdin wants to merge 1 commit into
Soju06:mainfrom
mahirozdin:feature/add-limit-warmup-trigger

Conversation

@mahirozdin
Copy link
Copy Markdown

Summary

Adds an opt-in, reset-confirmed limit warm-up trigger for Codex account quota windows. The feature sends at most one minimal warm-up request per account/window/reset after usage refresh confirms a reset from an exhausted sample to an available window.

Refs #709

Type of change

  • feat: — new user-facing feature or capability
  • fix: — bug fix (no behavior change beyond the bug)
  • refactor: — internal refactor (no behavior change, no API change)
  • docs: — documentation only
  • chore: / ci: / build: — tooling, CI, packaging
  • test: — test-only change
  • Breaking change

Linked issue: Related to #709

OpenSpec

  • This PR includes / updates an OpenSpec change
  • Not applicable — bug fix that matches the existing spec
  • Not applicable — docs / CI / chore only
  • This PR touches a codex-faithful path (internal Responses warm-up request) and preserves upstream-equivalent behavior; the warm-up request uses a minimal Responses payload with store=false, no conversation/session state, no tools, and an internal source/header for isolation.

Change directory: openspec/changes/add-limit-warmup-trigger/

Changes

  • Adds global and per-account limit warm-up settings, disabled by default.
  • Persists warm-up attempts with uniqueness by account/window/reset.
  • Runs warm-up only after leader-owned usage refresh confirms a reset.
  • Sends internal warm-up traffic with source=limit_warmup, store=false, internal header, no tools, and a small output cap.
  • Excludes warm-up logs from normal dashboard/request usage aggregates.
  • Adds dashboard settings controls, account opt-in toggles, and latest warm-up status.

Test plan

python -m ruff check .
python -m ruff format --check .
python -m pytest tests\unit\test_limit_warmup.py tests\integration\test_request_logs_api.py -q
python -m pytest tests\unit\test_request_logs_repository.py tests\unit\test_limit_warmup.py tests\integration\test_request_logs_api.py tests\integration\test_settings_api.py tests\integration\test_accounts_api.py tests\unit\test_db_migrate.py::test_schema_migration_contract_matches_after_upgrade -q
python -m pytest tests\integration\test_request_logs_list_count.py tests\integration\test_request_logs_filters.py tests\test_request_logs_options_api.py -q
python -m pytest tests\integration\test_migrations.py -q
cd frontend && npm run typecheck
cd frontend && npm run lint
cd frontend && npm test -- src/features/settings/schemas.test.ts src/features/settings/components/routing-settings.test.tsx src/features/settings/components/session-settings.test.tsx src/features/settings/components/totp-settings.test.tsx src/features/accounts/components/account-list.test.tsx src/features/dashboard/components/recent-requests-table.test.tsx src/features/dashboard/utils.test.ts src/test/mocks/handler-coverage.test.ts

Notes:

  • uv, bun, ty, and openspec CLI were not available in the local PATH, so equivalent available commands/subsets were run.
  • CHANGELOG.md was not edited.

Screenshots / output (optional)

N/A

Checklist

  • Title is in Conventional Commits format (<type>(<scope>)?: <subject>).
  • Linked the related issue / discussion above.
  • Added or updated tests covering the change.
  • Ran uv run pre-commit run local-ci --hook-stage manual --all-files or the relevant make <target> subset locally. Not run because uv and bun were unavailable in this environment; targeted backend/frontend subsets above were run instead.
  • If touching specs: openspec validate --specs passes and /opsx:verify is clean. Not run because openspec CLI was unavailable in this environment.
  • CHANGELOG is not edited by hand (release-please handles it).

@Komzpa
Copy link
Copy Markdown
Collaborator

Komzpa commented May 27, 2026

Closing this as superseded by the maintained reset-confirmed limit warm-up path that landed through #778 and #786.

Thanks @mahirozdin for the original feature work here. The current main implementation keeps the intended warm-up behavior and also includes the follow-up typing, threshold, opt-in refresh, concurrency, and shutdown fixes; this branch is now conflicting across the same feature surface and has no remaining unique delta I can identify.

If there is a new behavior still missing from current main, please open a fresh focused PR on top of current main.

@Komzpa Komzpa closed this May 27, 2026
@mahirozdin
Copy link
Copy Markdown
Author

@Komzpa Thanks for confirming that the original feature work from #773 was carried forward through #778 and #786.

One small attribution question: since the final maintained branch was merged from the repository-side repair branch, I noticed that my original contribution does not seem to appear in the repository contributors list. Would it be possible to preserve or acknowledge the attribution, for example through the existing all-contributors setup / README contributor table, if that matches the project’s contribution policy?

No issue if this is not applicable; I just wanted to clarify the expected attribution path for the original feature work.

@Komzpa
Copy link
Copy Markdown
Collaborator

Komzpa commented May 27, 2026

Thanks for pointing this out. You are right that the attribution should not disappear just because the maintained implementation landed through follow-up branches.

I opened #840 to add you to the all-contributors table for the warm-up feature work from this PR, restore the other recent merged contributors that were missing, and add a CI check so future commit contributors/PR authors are caught before this drifts again.

@mahirozdin
Copy link
Copy Markdown
Author

Thanks! Let's make codex-lb better together!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants