Repository navigation
feat(warmup): add staggered idle limit prestart - #905
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e54fb19155
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
e54fb19 to
5511e83
Compare
5511e83 to
1e76585
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e76585a22
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
5a26475 to
25c6976
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25c69766a4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
## Summary - Add a dashboard setting for weekly pace working days, defaulting to all seven days. - Apply configured working days to backend weekly credits pace schedule math so non-working days do not advance scheduled-by-now or pace-gap calculations. - Expose the setting through the settings API, audit changed-fields, shared settings payloads, and the settings UI. Closes #702. ## Maintainer Update - Rebased onto current `main`; current head is `6a1ccf7ddaa8fc92a9ef1d99c92cbe50288bdfe3`. - This PR no longer carries PostgreSQL CI narrowing changes; #899 remains the dedicated CI-only PR. - This PR no longer carries the proxy concurrent-usage-read fix; #902 now owns that usage/proxy behavior. - This remains separate from #905 because #702 weekly pace scheduling and #433 staggered idle warm-up are independent features, but both add settings migrations. Whichever migration PR merges second should be rebased onto the first merged migration head. ## Validation ```bash uv run openspec validate add-weekly-pace-working-days --strict uv run pytest tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_dashboard_overview.py -q uv run python - <<'PY' from alembic.script import ScriptDirectory from app.db.migrate import _build_alembic_config cfg = _build_alembic_config('sqlite:///tmp/alembic-head-check.db') script = ScriptDirectory.from_config(cfg) heads = script.get_heads() print('heads', heads) if len(heads) != 1: raise SystemExit(1) PY uv run ruff check app/modules/dashboard app/modules/settings app/db/models.py tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_dashboard_overview.py uv run ty check app/modules/dashboard app/modules/settings 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 npm run typecheck npm run lint npm test ```
1fec57b to
b60b31f
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b60b31f128
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
e5359ee to
a6fc6c6
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…ed-warmup # Conflicts: # frontend/src/features/settings/components/totp-settings.test.tsx # frontend/src/test/mocks/handlers.ts # tests/integration/test_migrations.py # tests/integration/test_settings_audit_changed_fields.py
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
## Summary - merge the two Alembic heads left after the #985/#902/#905 batch landed on `main` - keep the migration graph single-headed for startup migration upgrade targets ## Validation - `uv run python - <<'PY' ... ScriptDirectory.get_heads()` -> `20260630_010000_merge_warmup_and_request_log_dashboard_heads` - `uv run pytest tests/integration/test_migrations.py -q` -> 12 passed, 3 skipped - `uv run pytest tests/integration/test_migrations.py tests/unit/test_limit_warmup.py tests/unit/test_request_logs_repository.py tests/integration/test_usage_repository.py -q` -> 66 passed, 4 skipped - `uv run ruff check app/db/alembic/versions/20260630_010000_merge_warmup_and_request_log_dashboard_heads.py` -> pass - `git diff --check` -> pass
* fix(release): guard stable artifact publishing (#1049)
Add a stable release guard that verifies release-managed version fields are promoted consistently before stable artifact publishing can proceed.
- Validate pyproject, app version, frontend package, Helm chart, and uv.lock together
- Run the guard in CI and release workflows
- Cover release-please stable promotions, metadata repairs, and merge queue execution
* ci(helm): speed up kind smoke path (#1050)
Speed up the kind-based Helm smoke gate by avoiding avoidable chart-test image pulls and bounding Helm test waits.
- Make the Helm test pod image configurable while preserving the BusyBox default
- Point CI smoke Helm tests at the already-loaded app image
- Run the external DB smoke with one app replica
- Add timestamped smoke phase logs and a configurable Helm test timeout
- Add OpenSpec coverage and regression tests for the CI smoke contract
* chore(main): release 1.20.1 (#1039)
## [1.20.1](https://github.com/Soju06/codex-lb/compare/v1.20.0...v1.20.1) (2026-06-18)
### Bug Fixes
* **release:** guard stable artifact publishing (#1049)
### Performance Improvements
* **dashboard:** split request log page count (#1038)
This release republishes the stable train after the incomplete v1.20.0 artifact publish, with release-version validation in place so PyPI, Docker, and Helm publishing cannot proceed from drifted release metadata.
* fix(quota-planner): normalize decision datetimes for persistence (#1034)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* fix(proxy): avoid shielded-future log on startup probe timeout (#1076)
The streaming startup probes raced the first upstream item against a short
timeout with `asyncio.wait_for(asyncio.shield(first_task), timeout)`. On timeout
`wait_for` cancels the shield's outer future; when `first_task` later fails with
a `ProxyResponseError` (e.g. a 429 raised while the upstream is still blocked on
the response-create admission gate), Python 3.14's `asyncio.shield` reports the
inner exception through the loop exception handler as "ProxyResponseError
exception in shielded future" -- a spurious ERROR, since the same error is
already delivered to the caller through the streamed response.
Race the task with `asyncio.wait({first_task}, timeout=...)` instead, which never
cancels the task and does not wrap it in a shield. A done-callback retrieves the
task's result if the wrapping stream is dropped before the task is awaited, so an
abandoned probe task does not trip the "exception was never retrieved" warning
either. Consumers that await the task still observe the upstream error unchanged.
Closes #976
* fix(ci): ignore stale and resolved Codex inline findings (#981)
* fix(ci): ignore stale rebased codex inline comments
* fix(ci): ignore superseded duplicate check runs
* docs(openspec): document codex label evidence
* fix(ci): ignore resolved Codex inline findings
* fix(ci): keep current commit Codex evidence
* ci: resync codex labels after thread resolution
* fix(models): hide unsupported API models (#887)
* fix(models): hide unsupported API models
* fix(proxy): filter hidden codex allowlist models
* fix(models): add Codex models data alias
* feat(models): expose speed tiers in v1 metadata
* fix(models): type service tier metadata
* docs: add @KakatkarAkshay as contributor
* fix(models): omit absent speed tier metadata
* fix(models): stabilize codex model alias timestamps
* fix(models): keep spark in bootstrap catalog
---------
Co-authored-by: Akshay Kakatkar <[email protected]>
* fix(dashboard): correct weekly credits pace display (#955)
* fix(dashboard): count exhausted accounts in weekly pace
* fix(ui): clarify weekly pace over-plan wording
* fix(dashboard): exclude reauth accounts from weekly pace
* fix(dashboard): show weekly pace recommendations
* fix(dashboard): avoid calendar-blind pause estimate
* fix(docker): upgrade openssl runtime packages
* fix(docker): install legacy openssl provider explicitly
* fix(dashboard): label forecast shortfall danger
* fix(proxy): normalize non-native upstream requests to Codex CLI fingerprint (#1089)
* feat(proxy): normalize non-native upstream requests to Codex CLI fingerprint
Non-native http clients (e.g. the openai Python SDK) reach the ChatGPT/Codex
backend with a non-first-party fingerprint, so their requested `priority`
service tier is downgraded to `auto` (~20-29% vs ~3-6% for native Codex
clients) and `auto`-tier requests overload at ~85%, surfacing
`server_is_overloaded` on gpt-5.5.
Normalize the upstream client fingerprint to the Codex CLI (`codex_cli_rs`)
persona in `_build_upstream_headers` for non-native http requests:
- Rewrite `User-Agent` to `codex_cli_rs/<version> (<os>; <arch>) <terminal>`
using a new sync, network-free `CodexVersionCache.cached_version_or_default()`
and operator-configurable os/arch/terminal settings.
- Strip SDK-only `x-openai-client-*` headers and any inbound `originator`
(the real Codex CLI omits originator for the default and lets the backend
read it from the User-Agent prefix).
- Emit PascalCase `ChatGPT-Account-Id`.
Native Codex clients (User-Agent prefix or `x-codex-*`/native originator
headers) and websocket upstream requests are left unchanged. The original
client User-Agent is still recorded in `request_logs.useragent`.
Adds OpenSpec change `normalize-upstream-codex-fingerprint`
(outbound-http-clients delta).
* fix(proxy): base native exemption on UA/originator, not turn-state headers
Address Codex P2: an HTTP SDK client replays the upstream-issued
x-codex-turn-state continuity token, so keying the native exemption on
x-codex-* transport headers let non-native SDK follow-ups skip fingerprint
normalization and reach upstream with the downgraded OpenAI/Python +
x-openai-client-* fingerprint intact.
Restrict native detection to a first-party Codex User-Agent prefix or a
native originator header; continuity/transport headers are no longer a
native signal. The x-codex-turn-state header is still preserved (only the
fingerprint is normalized). Updates spec scenario + regression tests.
* fix: normalize non-native fingerprint on websocket upstream path
The auto stream transport routes a non-native SDK follow-up carrying an
x-codex-turn-state continuity token onto the websocket path, where
_build_upstream_websocket_headers forwarded the inbound OpenAI SDK
fingerprint (User-Agent + x-openai-client-*) unchanged. That bypassed the
HTTP-path normalization and let the priority-downgrade mitigation be
defeated for exactly the continuity-token scenario (Codex P1).
Make fingerprint normalization transport-agnostic: apply the same
codex_cli_rs persona rewrite, x-openai-client-* strip, originator strip,
and PascalCase ChatGPT-Account-Id in the websocket builder as in the HTTP
builder, gated on _is_native_codex_request. Native Codex clients and
continuity headers (x-codex-turn-state) are preserved on both paths.
Replace the test that asserted the websocket builder leaves fingerprints
untouched with regression tests covering websocket non-native turn-state
normalization and native websocket preservation. Update OpenSpec spec to
require normalization on every upstream transport path.
* fix(proxy): strip x-stainless SDK headers and keep account-id diagnostics
Address Codex P2/P3 on the upstream fingerprint normalization:
- P2: OpenAI SDKs send an x-stainless-* fingerprint family that the API
layer (_is_openai_sdk_request) treats as an SDK signal. Strip every
x-stainless-* header by prefix on both the http and websocket upstream
builders so a normalized request cannot still be identified as SDK
traffic and downgraded.
- P3: normalized non-native requests carry the account id under PascalCase
ChatGPT-Account-Id, but the upstream request start/complete log helpers
read it case-sensitively as chatgpt-account-id, logging account_id=None
for exactly the SDK traffic this feature investigates. Add a
case-insensitive _account_id_for_upstream_log helper and use it in both
log paths.
Regression tests cover x-stainless strip on http + websocket and the
case-insensitive account-id lookup. OpenSpec delta updated for both.
* fix(proxy): normalize fingerprint on client-facing responses websocket egress
The /v1/responses websocket egress builder in proxy_websocket.py is a third
upstream egress path alongside the http and internal auto-transport builders.
A non-native SDK connecting directly to the responses websocket reached
upstream with its OpenAI/Python + x-openai-client-* / x-stainless-* fingerprint
intact, bypassing the priority-downgrade mitigation.
Apply the shared non-native normalization (UA persona rewrite, SDK header strip,
PascalCase account header) on that builder too; native Codex websocket clients
are unchanged. Add regression tests and extend the OpenSpec change to require
normalization on all three egress paths.
Addresses Codex review P2 on PR #1089.
* fix(proxy): treat codex_sdk_ts as a native first-party originator
Codex review P2: codex_sdk_ts is a first-party Codex originator the
backend whitelists (named in the change proposal), but it was missing
from both the native originator allowlist and the native User-Agent
prefix list. A genuine Codex SDK (TypeScript) client was therefore
classified non-native and had its User-Agent rewritten to codex_cli_rs
and its originator stripped, violating the native-client exemption.
Add codex_sdk_ts to both native-detection sets, document it in the
OpenSpec native definition, and add regression tests for the originator
header and User-Agent prefix paths.
* chore: release v1.20.2-beta.1 (#1088)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* feat: smart HTTP→upstream transport routing (sticky vs single-shot) (#1093)
* feat: add smart HTTP transport routing
* fix(proxy): preserve auto transport mode for WS handshake fallback
* chore(ci): bump softprops/action-gh-release from 3.0.0 to 3.0.1 (#1067)
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/b4309332981a82ec1c5618f44dd2e27cc8bfbfda...718ea10b132b3b2eba29c1007bb80653f286566b)
---
updated-dependencies:
- dependency-name: softprops/action-gh-release
dependency-version: 3.0.1
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(docker): bump pgautoupgrade/pgautoupgrade (#1068)
Bumps pgautoupgrade/pgautoupgrade from 18-alpine to 18-alpine.
---
updated-dependencies:
- dependency-name: pgautoupgrade/pgautoupgrade
dependency-version: 18-alpine
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(ci): bump docker/build-push-action from 7.1.0 to 7.2.0 (#1069)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 7.1.0 to 7.2.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v7.1.0...f9f3042f7e2789586610d6e8b85c8f03e5195baf)
---
updated-dependencies:
- dependency-name: docker/build-push-action
dependency-version: 7.2.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(docker): bump astral-sh/uv from 0.11.21 to 0.11.23 (#1070)
Bumps [astral-sh/uv](https://github.com/astral-sh/uv) from 0.11.21 to 0.11.23.
- [Release notes](https://github.com/astral-sh/uv/releases)
- [Changelog](https://github.com/astral-sh/uv/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/uv/compare/0.11.21...0.11.23)
---
updated-dependencies:
- dependency-name: astral-sh/uv
dependency-version: 0.11.23
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(ci): bump actions/checkout from 6.0.2 to 7.0.0 (#1071)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.2 to 7.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/de0fac2e4500dabe0009e67214ff5f5447ce83dd...9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-version: 7.0.0
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(ci): bump github/codeql-action from 4.35.5 to 4.36.2 (#1072)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.35.5 to 4.36.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/9e0d7b8d25671d64c341c19c0152d693099fb5ba...8aad20d150bbac5944a9f9d289da16a4b0d87c1e)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-version: 4.36.2
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(deps): bump the frontend-minor-patch group (#1073)
Bumps the frontend-minor-patch group in /frontend with 6 updates:
| Package | From | To |
| --- | --- | --- |
| [lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react) | `1.18.0` | `1.21.0` |
| [react-hook-form](https://github.com/react-hook-form/react-hook-form) | `7.79.0` | `7.80.0` |
| [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) | `7.17.0` | `7.18.0` |
| [globals](https://github.com/sindresorhus/globals) | `17.6.0` | `17.7.0` |
| [react-doctor](https://github.com/millionco/react-doctor/tree/HEAD/packages/react-doctor) | `0.5.6` | `0.5.8` |
| [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.61.1` | `8.62.0` |
Updates `lucide-react` from 1.18.0 to 1.21.0
- [Release notes](https://github.com/lucide-icons/lucide/releases)
- [Commits](https://github.com/lucide-icons/lucide/commits/1.21.0/packages/lucide-react)
Updates `react-hook-form` from 7.79.0 to 7.80.0
- [Release notes](https://github.com/react-hook-form/react-hook-form/releases)
- [Changelog](https://github.com/react-hook-form/react-hook-form/blob/master/CHANGELOG.md)
- [Commits](https://github.com/react-hook-form/react-hook-form/compare/v7.79.0...v7.80.0)
Updates `react-router-dom` from 7.17.0 to 7.18.0
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/[email protected]/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/[email protected]/packages/react-router-dom)
Updates `globals` from 17.6.0 to 17.7.0
- [Release notes](https://github.com/sindresorhus/globals/releases)
- [Commits](https://github.com/sindresorhus/globals/compare/v17.6.0...v17.7.0)
Updates `react-doctor` from 0.5.6 to 0.5.8
- [Release notes](https://github.com/millionco/react-doctor/releases)
- [Changelog](https://github.com/millionco/react-doctor/blob/main/packages/react-doctor/CHANGELOG.md)
- [Commits](https://github.com/millionco/react-doctor/commits/[email protected]/packages/react-doctor)
Updates `typescript-eslint` from 8.61.1 to 8.62.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.62.0/packages/typescript-eslint)
---
updated-dependencies:
- dependency-name: lucide-react
dependency-version: 1.21.0
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: frontend-minor-patch
- dependency-name: react-hook-form
dependency-version: 7.80.0
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: frontend-minor-patch
- dependency-name: react-router-dom
dependency-version: 7.18.0
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: frontend-minor-patch
- dependency-name: globals
dependency-version: 17.7.0
dependency-type: direct:development
update-type: version-update:semver-minor
dependency-group: frontend-minor-patch
- dependency-name: react-doctor
dependency-version: 0.5.8
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: frontend-minor-patch
- dependency-name: typescript-eslint
dependency-version: 8.62.0
dependency-type: direct:development
update-type: version-update:semver-minor
dependency-group: frontend-minor-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(deps): bump @types/node from 25.9.3 to 26.0.0 in /frontend (#1074)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 25.9.3 to 26.0.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)
---
updated-dependencies:
- dependency-name: "@types/node"
dependency-version: 26.0.0
dependency-type: direct:development
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(deps): bump pydantic-settings from 2.14.1 to 2.14.2 (#1081)
Bumps [pydantic-settings](https://github.com/pydantic/pydantic-settings) from 2.14.1 to 2.14.2.
- [Release notes](https://github.com/pydantic/pydantic-settings/releases)
- [Commits](https://github.com/pydantic/pydantic-settings/compare/v2.14.1...v2.14.2)
---
updated-dependencies:
- dependency-name: pydantic-settings
dependency-version: 2.14.2
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(deps): bump the python-minor-patch group with 7 updates (#1075)
Bumps the python-minor-patch group with 7 updates:
| Package | From | To |
| --- | --- | --- |
| [certifi](https://github.com/certifi/python-certifi) | `2026.5.20` | `2026.6.17` |
| [greenlet](https://github.com/python-greenlet/greenlet) | `3.5.1` | `3.5.2` |
| [pydantic-settings](https://github.com/pydantic/pydantic-settings) | `2.14.1` | `2.14.2` |
| [pytest](https://github.com/pytest-dev/pytest) | `9.1.0` | `9.1.1` |
| [ruff](https://github.com/astral-sh/ruff) | `0.15.17` | `0.15.18` |
| [ty](https://github.com/astral-sh/ty) | `0.0.49` | `0.0.51` |
| [openai](https://github.com/openai/openai-python) | `2.41.1` | `2.43.0` |
Updates `certifi` from 2026.5.20 to 2026.6.17
- [Commits](https://github.com/certifi/python-certifi/compare/2026.05.20...2026.06.17)
Updates `greenlet` from 3.5.1 to 3.5.2
- [Changelog](https://github.com/python-greenlet/greenlet/blob/master/CHANGES.rst)
- [Commits](https://github.com/python-greenlet/greenlet/compare/3.5.1...3.5.2)
Updates `pydantic-settings` from 2.14.1 to 2.14.2
- [Release notes](https://github.com/pydantic/pydantic-settings/releases)
- [Commits](https://github.com/pydantic/pydantic-settings/compare/v2.14.1...v2.14.2)
Updates `pytest` from 9.1.0 to 9.1.1
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/9.1.0...9.1.1)
Updates `ruff` from 0.15.17 to 0.15.18
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.17...0.15.18)
Updates `ty` from 0.0.49 to 0.0.51
- [Release notes](https://github.com/astral-sh/ty/releases)
- [Changelog](https://github.com/astral-sh/ty/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ty/compare/0.0.49...0.0.51)
Updates `openai` from 2.41.1 to 2.43.0
- [Release notes](https://github.com/openai/openai-python/releases)
- [Changelog](https://github.com/openai/openai-python/blob/main/CHANGELOG.md)
- [Commits](https://github.com/openai/openai-python/compare/v2.41.1...v2.43.0)
---
updated-dependencies:
- dependency-name: certifi
dependency-version: 2026.6.17
dependency-type: direct:production
update-type: version-update:semver-minor
dependency-group: python-minor-patch
- dependency-name: greenlet
dependency-version: 3.5.2
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: python-minor-patch
- dependency-name: pydantic-settings
dependency-version: 2.14.2
dependency-type: direct:production
update-type: version-update:semver-patch
dependency-group: python-minor-patch
- dependency-name: pytest
dependency-version: 9.1.1
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: python-minor-patch
- dependency-name: ruff
dependency-version: 0.15.18
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: python-minor-patch
- dependency-name: ty
dependency-version: 0.0.51
dependency-type: direct:development
update-type: version-update:semver-patch
dependency-group: python-minor-patch
- dependency-name: openai
dependency-version: 2.43.0
dependency-type: direct:development
update-type: version-update:semver-minor
dependency-group: python-minor-patch
...
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: expose upstream transport observability (#1096)
## Summary
- add request_logs.upstream_transport and expose it through the request logs API/dashboard
- record upstream transport decisions via Prometheus across retry, websocket, bridge success, connect-failure, and pending-failure paths
- keep downstream transport and upstream transport distinct in persistence, API, and UI
## Verification
- CI green on current head c4904a08
- Codex review clean on current head c4904a08
- unresolved review threads: 0
- local targeted gates: 232 tests passed, ty/ruff/OpenSpec strict passed
* feat(proxy): repair account-bound egress routing (#875)
Summary:
- Repair account-bound upstream egress routing and installation identity propagation
- Preserve smart HTTP/WS upstream auto-fallback behavior after the downstream transport policy changes
- Keep fingerprint and account header normalization consistent across HTTP, internal WS, and direct WS egress paths
- Reconcile Alembic migration ancestry with current main
Validation:
- GitHub CI passed on b4028422d9f7ad14bdc578578ee816499b80f22c
- Local targeted proxy, bridge, migration, ruff, and OpenSpec checks passed before merge
- Current-head substitute Codex review found no blockers
* fix(proxy): oauth blocked when bindings lack route (#1064)
OAuth bootstrap passed account_id=None to the resolver, bypassing
per-account proxy routing. Token exchange went direct while all
subsequent API calls used the per-account proxy, causing OpenAI to
invalidate sessions after hours/days.
- _oauth_route() forces strict=True when active bindings exist,
requiring a default pool or failing closed
- _refresh_tokens() raises RefreshError when an account has a binding
but route resolution returns None
- Both binding-check helpers guard OperationalError for missing tables
* feat+fix(report): reports enhancements (#1060)
* feat(reports): fill gaps and sort daily breakdown
* feat(reports): polish summary and export sorting
* fix test
* update test
* Move aria-sort onto the column header
Move aria-sort onto the column header
* feat(reports): add useragent distributions
* fix(reports): preserve unknown user-agent bucket
* ruff
* separate Unknown with actually Unknown useragent
* feat(report): add donut value in report
* report: update donut tooltip behavior
* report: remove donut tooltip
* fix test
* feat(reset-credits): add banked rate-limit reset credits (#1053)
* feat(banked-reset): initial commit
* ui adjustments
* review
* ui adjustments
* feat(banked-reset): add api for query and redeem the credit (not in codex format)
* fix api to get all redeemable credit
* ty & ruff
* review
* fix(reset-credits): invalidate stale snapshots for ineligible accounts
* fix(reset-credits): critical consume hardening and zero-db migration adaptation
* fix(test): mock timers to prevent input-otp leaks in auth-gate
* fix(web): add space between datetime and countdown in reset credit dialog
* chore(web): remove auto-generated package-lock.json
* fix(api): address codex review findings for rate limit reset credits
* Align reset-credit eligibility and confirmation-dialog specs with current cache invalidation and redeem UX behavior.
* Disable default retries for reset credit redemption
* fix(reset-credits): stop status writes on 401, suppress stale reauth credits
Reset-credit polling must not mutate account status (spec
rate-limit-reset-credits: polling failures including 401 log and retain
the prior snapshot; usage refresh owns token refresh and deactivation).
The forced auth_manager.ensure_fresh(force=True) retry on a 401 flowed
into AuthManager.refresh_account, which persists REAUTH_REQUIRED /
DEACTIVATED on permanent refresh failure. Remove the auth_manager
retry loop from _refresh_account_reset_credits so a 401 logs and keeps
the cache in a single attempt. This also covers the dashboard GET
cache-miss path that reuses the helper.
Add REAUTH_REQUIRED to the account-summary ineligible set so a
reauth-required account with a stale cached snapshot no longer surfaces
available_reset_credits in list/header/dashboard badges, matching the
scheduler skip set and the GET/consume eligibility checks.
* Treat false force-refresh results as failures
* Fix reset-credit consume audit and refresh cache invalidation
* Clear skipped account snapshots before they can be reused
* Invalidate stale reset-credit cache on empty fresh fetch
* ruff & ty
* ruff
* Refresh usage after v1 reset-credit redemption
* Refresh account tokens before redeeming reset credits
* Handle refresh failures before redeeming reset credits
* Preserve successful reset-credit redemption response
* ruff
* Gate dashboard redemption on cached snapshot
* ruff
* docs: add @ellentane as a contributor
# Conflicts:
# .all-contributorsrc
# README.md
* fix reset-credit eligibility and confirm dialog closing
* Keep reset-credit GET cache-only
* Revert " Keep reset-credit GET cache-only"
This reverts commit 6fd64f45f17ca9b81354dd0ed735ce9d5e73ac3b.
* Serialize reset-credit redemption across replicas
* Re-select credits from the fresh upstream snapshot
* Treat null reset-credit details as unavailable
* Preserve skipped reset-credit snapshots and clear stale v1 conflicts
* feat(dashboard): add reset count bubble on the account list
* Badge Validate the redeem id before resolving proxy route
* Keep dashboard detail GET cache-only
---------
Co-authored-by: ellentane <[email protected]>
* fix(db): optimize dashboard query hot paths (#1107)
* chore(docker): bump pgautoupgrade/pgautoupgrade from 18-alpine to 18-alpine (#1109)
Dependabot dependency update.
Merged after live GitHub gate check and local targeted validation.
* chore(ci): bump azure/setup-helm from 5.0.0 to 5.0.1 (#1110)
Dependabot dependency update.
Merged after live GitHub gate check and local targeted validation.
* chore(ci): bump actions/cache from 5.0.5 to 6.1.0 (#1111)
Dependabot dependency update.
Merged after live GitHub gate check and local targeted validation.
* chore(docker): bump astral-sh/uv from 0.11.23 to 0.11.25 (#1112)
Dependabot dependency update.
Merged after live GitHub gate check and local targeted validation.
* chore(deps): bump the frontend-minor-patch group in /frontend with 12 updates (#1113)
Dependabot dependency update.
Merged after live GitHub gate check and local targeted validation.
* chore(deps): bump the python-minor-patch group with 11 updates (#1114)
Dependabot dependency update.
Merged after live GitHub gate check and local targeted validation.
* fix(frontend): persist dashboard account list sort (#1115)
Persist dashboard account list sort and document the behavior in OpenSpec.
- persist the dashboard account list sort selection alongside the existing card/list view preference
- wire DashboardPage to restore/update the saved sort column and direction
- update add-dashboard-account-list-view OpenSpec proposal, tasks, and frontend-architecture delta to cover sort persistence
Verification:
- git diff --check origin/main...HEAD
- openspec validate add-dashboard-account-list-view --strict
- openspec change show add-dashboard-account-list-view --json --deltas-only
- openspec validate --specs
- npx --yes [email protected] run test src/features/dashboard/components/account-list.test.tsx src/features/dashboard/components/dashboard-page.test.tsx src/hooks/use-dashboard-preferences.test.ts
- npx --yes [email protected] run typecheck
- npx --yes [email protected] run lint
- npx --yes [email protected] run build
- local OmO/OpenCode substitute review: VERDICT: SHIP
Supersedes #1035 because the contributor branch has maintainer edits disabled.
Closes #1035
* feat(frontend): restore Simplified Chinese i18n (#995)
Revive the Simplified Chinese frontend i18n work on top of current main.
- add i18next/react-i18next wiring, locale detection, html lang updates, and the language toggle
- add English and Simplified Chinese locale bundles plus translated auth/settings/status/header strings
- add the Simplified Chinese README and contributor metadata for the preserved translation work
- keep current-main settings/auth/routing/dashboard behavior while resolving stale branch conflicts
- add regression coverage for locale bootstrap, localized validation, status labels, and settings surfaces
Refs #671
Refs #780
* feat(usage-api): expose configurable usage details (#832)
- Add API-key usage section controls for `/v1/usage`
- Add pooled account usage visibility with privacy-toggle precedence
- Add API-key limit usage backfill from successful request logs
- Add dashboard/API/frontend settings for hiding upstream quota from API-key clients
- Refresh Alembic migrations and OpenSpec coverage
Validation:
- CI green on head 3787798b93bc5e0349b6dcff267e847e8c393a00
- Local Codex review APPROVE
- OpenSpec strict validation passed for all three active changes
- Targeted backend/frontend/migration checks passed
* feat(request-logs): record client IP (#985)
# feat(request-logs): record client IP (#985)
## Summary
- add nullable `request_logs.client_ip` plus an index and API/dashboard schema exposure
- capture client IPs through HTTP/SSE Responses, WebSocket Responses, compact requests, image compatibility routes, chat completions, and signed HTTP bridge owner forwarding
- add nullable `request_logs.archive_request_id` and expose it as `archiveRequestId` for dashboard request-log archive lookups
- keep response-id `requestId` semantics intact for continuity lookup, while the archive panel uses `archiveRequestId ?? requestId`
- show request metadata in the dashboard details table with field-specific copy buttons and search coverage
- add OpenSpec coverage for both request-log metadata contracts
Fixes #953
Fixes #962
Absorbs #984
## Validation
- `uv run pytest tests/integration/test_request_logs_api.py tests/integration/test_request_logs_filters.py tests/unit/test_request_logs_repository.py tests/unit/test_proxy_http_bridge.py`: 205 passed
- `uv run pytest tests/unit/test_proxy_http_bridge.py`: 178 passed
- `cd frontend && bun run test src/features/dashboard/components/recent-requests-table.test.tsx src/features/dashboard/schemas.test.ts`: 37 passed
- `uv run ruff check app/modules/proxy/_service/request_log.py app/modules/proxy/_service/http_bridge/streaming.py app/modules/request_logs tests/unit/test_proxy_http_bridge.py tests/unit/test_request_logs_repository.py tests/integration/test_request_logs_api.py tests/integration/test_request_logs_filters.py`: passed
- `uv run openspec validate add-request-log-client-ip --strict`: valid
- `uv run openspec validate fix-request-log-archive-lookup --strict`: valid
- `uv run openspec validate --specs`: 30 passed
- `git diff --check`: passed
Head: `dc41de33bd6f878dc31ec269f4f1c360dd05d6c3`
---
## Maintainer Refresh - 2026-06-30
# PR #985 refresh verification
## Strategy
- Used a merge refresh: `git merge --no-ff origin/main`.
- Rationale: this is an existing PR branch with prior repair/merge commits, so preserving PR branch context with one current-main merge commit is cleaner than rebasing the old repair history.
- Final commit: `f5815214d2b1e52912582163401a0c4b841e078c` (`Merge remote-tracking branch 'origin/main' into fix/issue-953-request-log-ip`).
- Push: not pushed.
## Conflicts resolved
- `app/modules/proxy/_service/compact.py`: kept current main request-kind logging and added PR `client_ip`.
- `app/modules/proxy/_service/http_bridge/request_submit.py`: kept current main installation-id, SDK-contract, and request-kind behavior; layered archive request-id send context and PR `client_ip`; changed archive-id fallback to explicit request-log id or generated request-state id.
- `app/modules/proxy/_service/http_bridge/streaming.py`: kept current main `enforce_openai_sdk_contract` and affinity policy paths; threaded `client_ip`.
- `app/modules/proxy/_service/streaming/mixin.py`: kept current main SDK-contract propagation; threaded `client_ip`.
- `app/modules/proxy/_service/streaming/retry.py`: kept current main upstream transport metrics and settlement guard; threaded `client_ip`.
- `app/modules/proxy/_service/websocket/mixin.py`: kept current main installation-id injection and upstream transport metrics; added archive request-id context around websocket sends and kept `client_ip` in log writes.
- `app/modules/proxy/api.py`: kept current main SDK-contract handling; threaded `client_ip`.
- `tests/unit/test_proxy_utils.py`: merged current main installation-id assertions with PR archive request-id assertions.
## Files changed by me beyond the mechanical merge
- Added `app/db/alembic/versions/20260630_000000_merge_request_log_client_ip_and_dashboard_hot_path_heads.py` to restore a single Alembic head.
- Adjusted `app/modules/proxy/_service/http_bridge/request_submit.py` conflict resolution, including deterministic `archive_request_id=request_log_id or resolved_request_id`.
- Updated `tests/unit/test_proxy_http_bridge.py` stale test double signature for `client_ip`.
- Restored `frontend/bun.lock` after `bun install` rewrote it locally.
## Final PR diff vs `origin/main`
`git diff --stat origin/main...HEAD` reports 50 files changed, 1574 insertions, 82 deletions. Major areas:
- Request log DB migrations/model/schema/repository/mappers.
- Proxy HTTP/SSE/WS client IP and archive request-id capture paths.
- Dashboard recent request metadata schema/table/tests.
- OpenSpec changes: `add-request-log-client-ip`, `fix-request-log-archive-lookup`.
- Tests for request logs, proxy HTTP bridge, websocket archiving, forwarding signatures, and migration coverage.
## Commands run
- `git fetch origin main fix/issue-953-request-log-ip`: passed.
- `git merge --no-ff origin/main`: conflicted in proxy stream/bridge/websocket files and `tests/unit/test_proxy_utils.py`; resolved manually.
- `uv run alembic heads` and `uv run python -m alembic heads`: failed because repo root Alembic CLI lacks `script_location`; used project migration helper instead.
- `uv run python - <<'PY' ... ScriptDirectory ... PY`: initially reported two heads; after adding the merge revision, passed with one head `20260630_000000_merge_request_log_client_ip_and_dashboard_hot_path_heads` and policy `()`.
- `uv run openspec validate add-request-log-client-ip --strict`: passed.
- `uv run openspec validate fix-request-log-archive-lookup --strict`: passed.
- `uv run openspec validate --specs`: passed, 30 specs valid.
- `uv run pytest tests/integration/test_migrations.py -q`: passed, 12 passed / 3 skipped.
- `uv run ruff check <touched Python files/tests>`: first failed on one unused conflict import; after cleanup passed.
- `uv run pytest tests/unit/test_request_logs_repository.py tests/integration/test_request_logs_api.py tests/integration/test_request_logs_filters.py tests/unit/test_proxy_http_bridge.py tests/integration/test_proxy_websocket_responses.py -q`: first failed 2 tests; after fixes passed, 276 passed / 1 warning.
- `bun run test src/features/dashboard/components/recent-requests-table.test.tsx src/features/dashboard/schemas.test.ts`: first failed because `vitest` was missing; after `bun install`, passed, 2 files / 37 tests.
- `uv run pytest tests/unit/test_proxy_utils.py::test_retry_http_bridge_request_on_fresh_upstream_uses_archive_request_id tests/unit/test_proxy_utils.py::test_submit_http_bridge_request_uses_archive_request_id_during_inline_and_send tests/unit/test_proxy_utils.py::test_websocket_archive_request_id_for_non_text_uses_single_pending_request tests/unit/test_proxy_utils.py::test_websocket_archive_request_id_for_non_text_keeps_ambiguous_frames_unattributed -q`: failed due stale test id.
- `uv run pytest tests/unit/test_proxy_utils.py::test_retry_http_bridge_request_on_fresh_upstream_uses_archive_request_id tests/unit/test_proxy_utils.py::test_submit_http_bridge_request_reinlines_final_text tests/unit/test_proxy_utils.py::test_websocket_archive_request_id_for_non_text_uses_single_pending_request tests/unit/test_proxy_utils.py::test_websocket_archive_request_id_for_non_text_keeps_ambiguous_frames_unattributed -q`: passed, 4 passed.
- `git diff --check`: passed.
- `git commit --no-edit`: passed, created `f5815214d2b1e52912582163401a0c4b841e078c`.
## Remaining blockers
- None known locally.
- Local test warnings observed: FastAPI/TestClient deprecation warning for `httpx`; existing environment warning that `VIRTUAL_ENV=/home/ubuntu/.hermes/hermes-agent/venv` is ignored in favor of `.venv`.
* perf(usage): avoid repeated history cache scans (#902)
# perf(usage): avoid repeated history cache scans (#902)
## Summary
- Avoid re-reading/fingerprinting the full cached SQLite usage-history window on dashboard bulk-history cache hits; append only rows newer than the cached max ID.
- Keep compact SQLite aggregate metadata for the cached row range so same-ID corrections, deletes, and ID reuse invalidate stale cached history before dashboard depletion state is reused.
- Clear the SQLite bulk-history cache when account merge/delete paths mutate `usage_history` ownership.
- Add a SQLite fast path for additional-usage latest-per-account reads so additional quota lookups avoid `row_number()` window scans while preserving the depletion tie-breaker for same-timestamp rows.
- Avoid concurrent usage-history reads on one SQLAlchemy `AsyncSession`, fixing the PostgreSQL sticky-session fallback case when a pinned account is rate-limited.
Mitigates #708.
## Maintainer Update
- Rebased onto current `main`; current head is `629a2aba0a67f99c7508ad91f217f81b33b3ead6`.
- This PR no longer carries PostgreSQL CI narrowing changes; #899 remains the dedicated PR for that CI-only work.
- The branch contains the usage-cache/proxy behavior and its tests/spec, plus a current-head Codex follow-up that makes the SQLite additional-usage fast path match the SQLAlchemy ordering: `recorded_at desc, used_percent desc, id desc`.
## Validation
```bash
uv run openspec validate optimize-usage-history-cache --strict
uv run pytest tests/unit/test_additional_usage_repo.py::test_latest_by_account_sqlite_fast_path_uses_depletion_tie_breaker tests/unit/test_additional_usage_repo.py::test_latest_by_account_merges_alias_rows_conservatively -q
uv run pytest tests/integration/test_usage_repository.py tests/unit/test_additional_usage_repo.py -q
uv run pytest tests/integration/test_proxy_sticky_sessions.py::test_proxy_sticky_switches_when_pinned_rate_limited -q
uv run ruff check app/modules/usage/repository.py app/modules/accounts/repository.py app/modules/proxy/load_balancer.py tests/integration/test_usage_repository.py tests/unit/test_additional_usage_repo.py
uv run ruff check app/modules/usage/repository.py tests/unit/test_additional_usage_repo.py
uv run ty check app/modules/usage app/modules/accounts app/modules/proxy/load_balancer.py
uv run ty check app/modules/usage/repository.py tests/unit/test_additional_usage_repo.py
```
---
## Maintainer Refresh - 2026-06-30
# PR #902 Refresh Verification
## Strategy
- Strategy used: `git rebase origin/main`
- Rationale: the PR had three commits on an old base and no upstream configured; rebasing kept the existing PR history linear and maintainer-friendly.
- Original PR head before refresh: `6ef31e9d5c88baa7243fae1dc3c564e7e7f0e68e`
- New base: `origin/main` at `70576a1eeedc8f41b52548714391ba11167c1f93`
- Final branch head: `88d6e794eb2c369705469b25434eb7c27458f895`
## Conflicts Resolved
- `app/modules/usage/repository.py`
- Conflict occurred while replaying `c9056402 perf(usage): avoid repeated history cache scans`.
- Resolution preserved current `origin/main` PostgreSQL additional-usage canonical query plus raw-alias fallback.
- Resolution preserved the PR SQLite fast path for additional latest-per-account reads.
- Resolution kept the generic non-SQLite window-function fallback.
## Files Changed By This Refresh
- Rebased PR changes retained:
- `app/modules/accounts/repository.py`
- `app/modules/usage/repository.py`
- `openspec/changes/optimize-usage-history-cache/proposal.md`
- `openspec/changes/optimize-usage-history-cache/specs/query-caching/spec.md`
- `openspec/changes/optimize-usage-history-cache/tasks.md`
- `tests/integration/test_usage_repository.py`
- `tests/unit/test_additional_usage_repo.py`
- Additional refresh commit added:
- `tests/unit/test_additional_usage_repo.py`
- Added `test_latest_by_account_sqlite_fast_path_preserves_newer_raw_alias` for the critical canonical-older/raw-alias-newer SQLite fast-path case.
## Commands Run
- `git status --short --branch`
- Pass: clean before rebase on `fix/usage-history-cache-708`; clean after final commit.
- `git fetch origin main`
- Pass: fetched `origin/main`.
- `uv run openspec status --change optimize-usage-history-cache --json`
- Pass: change exists; 8/8 tasks complete.
- `uv run openspec instructions apply --change optimize-usage-history-cache --json`
- Pass: change state `all_done`.
- `git rev-parse HEAD origin/main FETCH_HEAD`
- Pass: confirmed original head, `origin/main`, and fetched head.
- `git merge-base HEAD origin/main`
- Pass: old merge base was `2830b7d51956872795f2ebbdeff08cb67fe5a3c9`.
- `git log --oneline --left-right --cherry-pick HEAD...origin/main | sed -n '1,120p'`
- Pass: confirmed branch had three unique PR commits and `origin/main` had advanced.
- `git diff --stat origin/main...HEAD`
- Pass: reviewed stale PR diff before rebase.
- `git rebase origin/main`
- Pass after one conflict resolution in `app/modules/usage/repository.py`.
- `rg -n "<<<<<<<|=======|>>>>>>>" app/modules/usage/repository.py`
- Pass: no conflict markers after resolution.
- `uv run python -m py_compile app/modules/usage/repository.py`
- Pass: resolved file compiled.
- `git diff --check`
- Pass: no whitespace/conflict-marker issues.
- `GIT_EDITOR=true git rebase --continue`
- Pass: rebase completed and updated `fix/usage-history-cache-708`.
- `uv run pytest tests/unit/test_additional_usage_repo.py::test_latest_by_account_sqlite_fast_path_preserves_newer_raw_alias -q`
- Pass: `1 passed in 0.46s`.
- `uv run openspec validate optimize-usage-history-cache --strict`
- Pass: `Change 'optimize-usage-history-cache' is valid`.
- `uv run openspec validate --specs`
- Pass: `30 passed, 0 failed`.
- `uv run ruff check app/modules/usage/repository.py app/modules/accounts/repository.py app/modules/proxy/load_balancer.py tests/integration/test_usage_repository.py tests/unit/test_additional_usage_repo.py`
- Pass: `All checks passed!`.
- `uv run pytest tests/unit/test_additional_usage_repo.py tests/integration/test_usage_repository.py tests/integration/test_proxy_sticky_sessions.py::test_proxy_sticky_switches_when_pinned_rate_limited -q`
- Pass: `45 passed, 1 skipped in 4.39s`.
- Skip: `tests/integration/test_usage_repository.py:304` PostgreSQL-only query plan test.
- `uv run ty check app/modules/usage app/modules/accounts app/modules/proxy/load_balancer.py`
- Pass: `All checks passed!`.
- `for f in app/modules/usage/repository.py app/modules/accounts/repository.py tests/integration/test_usage_repository.py tests/unit/test_additional_usage_repo.py; do printf '%s ' "$f"; awk '!/^[[:space:]]*$/ && !/^[[:space:]]*(#|\\/\\/|--)/' "$f" | wc -l; done`
- Pass: measured touched source/test file sizes.
- Results: `app/modules/usage/repository.py 1134`, `app/modules/accounts/repository.py 778`, `tests/integration/test_usage_repository.py 719`, `tests/unit/test_additional_usage_repo.py 915`.
- `git commit -m "test(usage): cover sqlite latest raw aliases"`
- Pass: created `88d6e794eb2c369705469b25434eb7c27458f895`.
## Final Commits On Branch
- `88d6e794 test(usage): cover sqlite latest raw aliases`
- `d732664d docs(usage): align cache spec tie-breaker`
- `a8144b44 fix(usage): preserve sqlite depletion tie-breaker`
- `57af7adc perf(usage): avoid repeated history cache scans`
## Remaining Blockers
- None found locally.
- Not pushed.
* feat(warmup): add staggered idle limit prestart (#905)
# feat(warmup): add staggered idle limit prestart (#905)
## Summary
- add an opt-in `limitWarmupStaggeredIdleEnabled` setting, API field, migration, and dashboard toggle
- let the background usage-refresh warm-up service pre-start healthy idle primary 5h windows in deterministic account slots across each 300-minute cycle
- require a fresh in-cycle idle usage sample before sending staggered idle warm-up traffic, catch deterministic slots between refresh ticks, and label `primary_idle` as the 5h window in the dashboard
- preserve the staggered-idle flag across full dashboard settings saves after rebasing onto the current settings payload shape
Closes #433.
## Maintainer Update
- Rebased onto current `main`; current head is `1fec57b8717af3e67a50e60d6b51ebd8b24e6b49`.
- The Alembic revision now follows `20260604_000000_add_reauth_required_account_status`, leaving a single head: `20260603_000000_add_limit_warmup_staggered_idle`.
- The Codex review findings are addressed: `primary_idle` renders as the primary 5h window, idle warm-up requires a fresh usage sample for the account/cycle, and the stagger slot window now follows the configured refresh cadence so nonzero refresh duration does not skip a deterministic slot.
## Validation
```bash
uv run ruff check app/modules/settings app/modules/limit_warmup app/core/usage/refresh_scheduler.py tests/unit/test_limit_warmup.py tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_migrations.py
uv run ruff check app/modules/limit_warmup/service.py app/core/usage/refresh_scheduler.py tests/unit/test_limit_warmup.py
uv run pytest tests/unit/test_limit_warmup.py -q
uv run pytest tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_migrations.py -q
uv run ty check app/modules/limit_warmup app/core/usage/refresh_scheduler.py tests/unit/test_limit_warmup.py
uv run openspec validate database-migrations --strict
uv run openspec validate frontend-architecture --strict
uv run openspec validate usage-refresh-policy --strict
uv run python - <<'PY'
from alembic.script import ScriptDirectory
from app.db.migrate import _build_alembic_config
cfg = _build_alembic_config('sqlite:///tmp/alembic-head-check.db')
script = ScriptDirectory.from_config(cfg)
heads = script.get_heads()
print('heads', heads)
if len(heads) != 1:
raise SystemExit(1)
PY
make typecheck
npm run typecheck
npm run lint
npm test -- src/features/dashboard/components/account-card.test.tsx 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
npm test
```
---
## Maintainer Refresh - 2026-06-30
# PR 905 Refresh Verification
## Strategy
- Refreshed `fix/issue-433-staggered-warmup` by rebasing the existing PR branch onto current `origin/main` (`70576a1eeedc8f41b52548714391ba11167c1f93`).
- Chose rebase because the PR branch was linear and this keeps the existing PR history maintainer-friendly.
- Did not push.
## Conflicts Resolved
- `app/core/usage/refresh_scheduler.py`
- Conflict occurred while applying `fix(warmup): require fresh idle usage samples`.
- Resolution preserved current main's one-account-at-a-time usage refresh scheduler and added the PR's `refresh_started_at` timestamp before refreshing the selected account.
- The timestamp is passed to `LimitWarmupService.run_after_usage_refresh(...)` so staggered idle warmup still requires an in-cycle fresh usage sample.
## Files Changed By Me During Refresh
- `app/core/usage/refresh_scheduler.py`
- Manual rebase conflict resolution, now included in rebased commit `a8076d87`.
- `app/db/alembic/versions/20260630_000000_add_limit_warmup_staggered_idle.py`
- Renamed from `20260603_000000_add_limit_warmup_staggered_idle.py`.
- Updated revision id to `20260630_000000_add_limit_warmup_staggered_idle`.
- Updated `down_revision` to current main head `20260629_000000_add_dashboard_query_hot_path_indexes`.
## Commands Run
- `git fetch origin main`
- PASS: fetched current `origin/main`.
- `git rebase origin/main`
- PASS after resolving one conflict in `app/core/usage/refresh_scheduler.py`.
- `uv run alembic heads`
- FAIL: plain Alembic config has no `script_location`; replaced with project migration checks below.
- `uv run python - <<'PY' ... ScriptDirectory.from_config(...).get_heads() ... PY`
- PASS: single Alembic head is `20260630_000000_add_limit_warmup_staggered_idle`.
- `uv run python - <<'PY' ... check_migration_policy('sqlite:///unused.sqlite') ... PY`
- PASS: `violations= ()`.
- `uv run openspec validate limit-warmup-staggered-idle --strict`
- PASS: change is valid.
- `uv run openspec validate --specs`
- PASS: 30 specs passed, 0 failed.
- `uv run pytest tests/unit/test_limit_warmup.py tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_migrations.py -q`
- PASS: 83 passed, 3 skipped. Skips were PostgreSQL-only migration tests.
- `uv run ruff check app/core/usage/refresh_scheduler.py app/db/models.py app/db/alembic/versions/20260630_000000_add_limit_warmup_staggered_idle.py app/modules/limit_warmup/service.py app/modules/settings/api.py app/modules/settings/repository.py app/modules/settings/schemas.py app/modules/settings/service.py tests/unit/test_limit_warmup.py tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_migrations.py`
- PASS: all checks passed.
- `uv run ty check app/modules/limit_warmup app/core/usage/refresh_scheduler.py app/modules/settings tests/unit/test_limit_warmup.py`
- PASS: all checks passed.
- `bun run test ...`
- FAIL initially: `vitest: command not found` because frontend dependencies were not installed.
- `bun run lint ...`
- FAIL initially: `eslint: command not found` because frontend dependencies were not installed.
- `bun install --frozen-lockfile`
- PASS: installed frontend dependencies from existing lockfile.
- `bun run test src/features/dashboard/components/account-card.test.tsx src/features/dashboard/components/account-list.test.tsx 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/settings/payload.test.ts src/features/settings/schemas.test.ts`
- PASS: 7 test files passed, 69 tests passed.
- `bun run lint src/features/dashboard/components/account-card.tsx src/features/dashboard/components/account-card.test.tsx src/features/dashboard/components/account-list.tsx src/features/dashboard/components/account-list.test.tsx src/features/settings/components/routing-settings.tsx src/features/settings/components/routing-settings.test.tsx src/features/settings/components/session-settings.test.tsx src/features/settings/components/settings-page.tsx src/features/settings/components/totp-settings.test.tsx src/features/settings/payload.ts src/features/settings/payload.test.ts src/features/settings/schemas.ts src/features/settings/schemas.test.ts src/test/mocks/factories.ts src/test/mocks/handlers.ts`
- PASS.
- `bun run typecheck`
- PASS: `tsc -b`.
- `rg -n "<<<<<<<|=======|>>>>>>>" app tests frontend openspec || true`
- PASS for merge-conflict purposes: no conflict markers found; matches were existing separator comments.
- `git commit -m "fix(db): refresh staggered warmup migration head"`
- PASS: final commit created.
## Final Commit
- `a6fc6c65f8299d6a2885bd9a4ea5e62606cd6157` - `fix(db): refresh staggered warmup migration head`
## Remaining Blockers
- None known locally.
- Branch was not pushed, per instruction.
* fix(db): merge post-batch migration heads (#1116)
## Summary
- merge the two Alembic heads left after the #985/#902/#905 batch landed on `main`
- keep the migration graph single-headed for startup migration upgrade targets
## Validation
- `uv run python - <<'PY' ... ScriptDirectory.get_heads()` -> `20260630_010000_merge_warmup_and_request_log_dashboard_heads`
- `uv run pytest tests/integration/test_migrations.py -q` -> 12 passed, 3 skipped
- `uv run pytest tests/integration/test_migrations.py tests/unit/test_limit_warmup.py tests/unit/test_request_logs_repository.py tests/integration/test_usage_repository.py -q` -> 66 passed, 4 skipped
- `uv run ruff check app/db/alembic/versions/20260630_010000_merge_warmup_and_request_log_dashboard_heads.py` -> pass
- `git diff --check` -> pass
* fix(ci): clear lint/type/frontend failures surfaced by the upstream sync
Follow-up to the conflict-resolution merge, fixing CI on PR #7:
- frontend: add the now-required onResetCredit prop to the force-probe
AccountActions test render (merge combined upstream's reset-credit prop
with a fork test render that predated it). Unblocks frontend-build,
frontend-typecheck, package, docker and every pytest job (they build the
frontend first).
- ruff format: normalize three auto-merged files
(app/core/config/settings.py, tests/unit/test_api_keys_service.py,
tests/unit/test_proxy_utils.py).
- ty: declare force_include_usage on ApiKeysRepositoryProtocol.update (the
concrete repo and the service call already had it; the fork's flag was
never added to the Protocol and main-push CI never type-checked it), and
satisfy the type checker in the fork's reauth/probe tests via cast()/
setattr — pre-existing gaps the sync PR's pull_request CI surfaced.
* fix(settings): restore additional_quota_routing_policies persistence dropped by merge
The auto-merge of settings/repository.py silently dropped the write block
that persists additional_quota_routing_policies_json in SettingsRepository
.update() (both parents had it; the keyword param survived but the
assignment was lost). As a result PUT /api/settings ignored
additionalQuotaRoutingPolicies overrides, so they never persisted.
Restore the two-line assignment in its original position (between the
sticky-reallocation-secondary and warmup-model blocks), fixing the two
integration-core failures:
- test_settings_api_returns_known_additional_quota_policies
- test_accounts_list_returns_additional_quotas
---------
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Soju06 <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: ozpool <[email protected]>
Co-authored-by: Darafei Praliaskouski <[email protected]>
Co-authored-by: Akshay Kakatkar <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: tobwen <[email protected]>
Co-authored-by: Jacky Fong <[email protected]>
Co-authored-by: ellentane <[email protected]>
Co-authored-by: MAISRIEMLER Martin <[email protected]>
The staggered idle warm-up feature (PR Soju06#905, issue Soju06#433) never fired in practice because the idle gate required `used_percent == 0.0`, but the upstream ChatGPT API reports a 1.0% floor for idle primary 5h windows. Additionally, the dashboard's "Exhausted at %" setting (`limit_warmup_exhausted_threshold_percent`) was only wired to the regular (post-exhaustion) warm-up path, not to the staggered idle path. The UI places this field in the shared warm-up settings grid beneath the staggered idle toggle, so operators reasonably expect it to control both warm-up modes. Wire `limit_warmup_exhausted_threshold_percent` into `_build_staggered_idle_candidate` so the "Exhausted at %" field controls the idle gate for both warm-up modes. With the default threshold of 99.0%, accounts at or below 99% used are considered idle. Operators can lower this to be more conservative (e.g. 1.0 to only warm truly idle accounts at the upstream floor).
…arm-up The staggered idle warm-up feature (PR Soju06#905, issue Soju06#433) never fired in practice because the idle gate required `used_percent == 0.0`, but the upstream ChatGPT API reports a 1.0% floor for idle primary 5h windows. Additionally, the dashboard's "Exhausted at %" setting was only wired to the regular (post-exhaustion) warm-up path. The UI places it in the shared warm-up grid, making operators expect it to control both modes. Reusing it for staggered idle would be semantically wrong: 99.0% means "exhausted" for regular warm-up but "almost everything is idle" for staggered idle — opposite semantics. Add a separate `limit_warmup_idle_threshold_percent` setting (default 1.0) that independently controls the staggered idle gate. Add an Alembic migration, wire the new setting into the warm-up service, and add an "Idle at %" input to the dashboard UI beneath the staggered idle toggle.
…#1230) * fix(warmup): wire exhausted threshold to staggered idle warm-up The staggered idle warm-up feature (PR #905, issue #433) never fired in practice because the idle gate required `used_percent == 0.0`, but the upstream ChatGPT API reports a 1.0% floor for idle primary 5h windows. Additionally, the dashboard's "Exhausted at %" setting (`limit_warmup_exhausted_threshold_percent`) was only wired to the regular (post-exhaustion) warm-up path, not to the staggered idle path. The UI places this field in the shared warm-up settings grid beneath the staggered idle toggle, so operators reasonably expect it to control both warm-up modes. Wire `limit_warmup_exhausted_threshold_percent` into `_build_staggered_idle_candidate` so the "Exhausted at %" field controls the idle gate for both warm-up modes. With the default threshold of 99.0%, accounts at or below 99% used are considered idle. Operators can lower this to be more conservative (e.g. 1.0 to only warm truly idle accounts at the upstream floor). * fix(warmup): add separate idle threshold setting for staggered idle warm-up The staggered idle warm-up feature (PR #905, issue #433) never fired in practice because the idle gate required `used_percent == 0.0`, but the upstream ChatGPT API reports a 1.0% floor for idle primary 5h windows. Additionally, the dashboard's "Exhausted at %" setting was only wired to the regular (post-exhaustion) warm-up path. The UI places it in the shared warm-up grid, making operators expect it to control both modes. Reusing it for staggered idle would be semantically wrong: 99.0% means "exhausted" for regular warm-up but "almost everything is idle" for staggered idle — opposite semantics. Add a separate `limit_warmup_idle_threshold_percent` setting (default 1.0) that independently controls the staggered idle gate. Add an Alembic migration, wire the new setting into the warm-up service, and add an "Idle at %" input to the dashboard UI beneath the staggered idle toggle. * fix(warmup): redesign warm-up settings UI with separate threshold cards Restructure the warm-up settings panel into two clearly separated side-by-side cards: 'Reset-confirmed warm-up' (with Exhausted at %) and 'Staggered idle warm-up' (with Idle at %). Shared settings (Windows, Model, Cooldown, Prompt) are in a flat grid above. Update tests to enable warm-up before testing limit warm-up controls. * fix(warmup): rename threshold labels to 'Min usage %' and 'Max usage %' Rename the warm-up threshold UI labels for clarity: - 'Exhausted at %' → 'Min usage %' (regular warm-up, default 99) - 'Idle at %' → 'Max usage %' (staggered idle, default 1) The Min/Max prefix makes the direction clear, and 'usage' ties it to the account usage meter already visible on the dashboard. * fix(ui): shorten 'Save warmup model' button to 'Save' The button text 'Save warmup model' is redundant since it sits in the 'Warmup model' section. Shorten to 'Save' to match the limit warm-up section's Save button. * fix(warmup): ignore upstream reset_at timestamp jitter in warm-up gate The reset-confirmed warm-up condition `after.reset_at > before.reset_at` was too sensitive — upstream can report reset_at values that fluctuate by ~1 second between refresh cycles. This caused false warm-up triggers mid-window when 'Min usage %' was set to a low value. Require a minimum 60-second forward jump to confirm a real quota window reset. Add regression test asserting that a 1-second reset_at jitter does not trigger a warm-up. * fix(openspec): sync change artifacts with delivered jitter fix and UI redesign Update proposal to mention the reset_at jitter fix and the side-by-side card UI redesign. Update tasks to include all delivered changes. Fix the reset-confirmed scenario to require a 60-second reset_at jump and add a new scenario for jitter rejection. * fix(warmup): address review feedback — i18n, boundary tests, scoped queries 1. Change idle_threshold_percent default from 0.0 to 1.0 to match the persisted/API contract default and prevent dead-code regression. 2. Move hardcoded English UI strings into i18n (en.json + zh-CN.json) under settings.routing.limitWarmup.resetConfirmed/staggeredIdle. 3. Add 60-second boundary tests: 59s rejected, 60s accepted. 4. Add frontend interaction test for Max usage % input. 5. Add aria-label 'Save warm-up settings' to the limit warm-up Save button and use scoped getByRole queries instead of brittle getAllByRole().at(-1) in tests. * fix(review): separate merged test, move remaining hardcoded strings to i18n Split the accidentally merged test_staggered_idle_warmup_catches_slot_between_refresh_ticks back into its own function. Move remaining hardcoded UI labels (Windows, Model, Cooldown, Prompt) into i18n locales for both en and zh-CN. * fix(db): rebase migration onto origin/main head The new add_dashboard_prohibit_fast_mode migration on origin/main shares the same down_revision. Update our migration to depend on it to maintain a single Alembic head. * fix(warmup): tolerance-based idle dedupe, keep settings visible Address Codex review P2 findings: 1. Staggered idle dedupe: replace stateless bucketing (flooring/midpoint rounding) with tolerance-based deduplication. The repository's try_create_attempt now accepts reset_at_tolerance_seconds and checks for existing attempts within ±5 seconds for primary_idle window only. This handles all jitter boundary cases (18000/18001, 18029/18030, 18059/18060) without any canonicalization or schedule distortion. Regular warm-up attempts keep exact tuple deduplication. 2. Keep warm-up settings visible when limit warm-up is disabled. The previous conditional hid the config fields when warm-up was off, forcing operators to enable first before staging settings. Now the fields are always visible so operators can configure before enabling. Add regression tests: 1-second jitter dedupe, minute-boundary dedupe (18059/18060), and regular warm-up jitter rejection. * fix(db): re-parent warm-up idle threshold migration onto concurrency-caps head Chain the warm-up idle-threshold migration after the account concurrency caps migration (#1214) so the post-merge Alembic graph stays single-headed: #1224 (add_account_chatgpt_user_id) -> #1214 (concurrency caps, 020000) -> this revision (030000). Re-timestamp to 030000 and point down_revision at the concurrency-caps revision. The new column keeps its NOT NULL server_default (1.0) so existing rows backfill, and downgrade drops it. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Soju06 <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]>
## Summary - Add a dashboard setting for weekly pace working days, defaulting to all seven days. - Apply configured working days to backend weekly credits pace schedule math so non-working days do not advance scheduled-by-now or pace-gap calculations. - Expose the setting through the settings API, audit changed-fields, shared settings payloads, and the settings UI. Closes Soju06#702. ## Maintainer Update - Rebased onto current `main`; current head is `6a1ccf7ddaa8fc92a9ef1d99c92cbe50288bdfe3`. - This PR no longer carries PostgreSQL CI narrowing changes; Soju06#899 remains the dedicated CI-only PR. - This PR no longer carries the proxy concurrent-usage-read fix; Soju06#902 now owns that usage/proxy behavior. - This remains separate from Soju06#905 because Soju06#702 weekly pace scheduling and Soju06#433 staggered idle warm-up are independent features, but both add settings migrations. Whichever migration PR merges second should be rebased onto the first merged migration head. ## Validation ```bash uv run openspec validate add-weekly-pace-working-days --strict uv run pytest tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_dashboard_overview.py -q uv run python - <<'PY' from alembic.script import ScriptDirectory from app.db.migrate import _build_alembic_config cfg = _build_alembic_config('sqlite:///tmp/alembic-head-check.db') script = ScriptDirectory.from_config(cfg) heads = script.get_heads() print('heads', heads) if len(heads) != 1: raise SystemExit(1) PY uv run ruff check app/modules/dashboard app/modules/settings app/db/models.py tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_dashboard_overview.py uv run ty check app/modules/dashboard app/modules/settings 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 npm run typecheck npm run lint npm test ```
# feat(warmup): add staggered idle limit prestart (Soju06#905) ## Summary - add an opt-in `limitWarmupStaggeredIdleEnabled` setting, API field, migration, and dashboard toggle - let the background usage-refresh warm-up service pre-start healthy idle primary 5h windows in deterministic account slots across each 300-minute cycle - require a fresh in-cycle idle usage sample before sending staggered idle warm-up traffic, catch deterministic slots between refresh ticks, and label `primary_idle` as the 5h window in the dashboard - preserve the staggered-idle flag across full dashboard settings saves after rebasing onto the current settings payload shape Closes Soju06#433. ## Maintainer Update - Rebased onto current `main`; current head is `28324f997ad9eb63622a76ecade3bb8075fb80e0`. - The Alembic revision now follows `20260604_000000_add_reauth_required_account_status`, leaving a single head: `20260603_000000_add_limit_warmup_staggered_idle`. - The Codex review findings are addressed: `primary_idle` renders as the primary 5h window, idle warm-up requires a fresh usage sample for the account/cycle, and the stagger slot window now follows the configured refresh cadence so nonzero refresh duration does not skip a deterministic slot. ## Validation ```bash uv run ruff check app/modules/settings app/modules/limit_warmup app/core/usage/refresh_scheduler.py tests/unit/test_limit_warmup.py tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_migrations.py uv run ruff check app/modules/limit_warmup/service.py app/core/usage/refresh_scheduler.py tests/unit/test_limit_warmup.py uv run pytest tests/unit/test_limit_warmup.py -q uv run pytest tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_migrations.py -q uv run ty check app/modules/limit_warmup app/core/usage/refresh_scheduler.py tests/unit/test_limit_warmup.py uv run openspec validate database-migrations --strict uv run openspec validate frontend-architecture --strict uv run openspec validate usage-refresh-policy --strict uv run python - <<'PY' from alembic.script import ScriptDirectory from app.db.migrate import _build_alembic_config cfg = _build_alembic_config('sqlite:///tmp/alembic-head-check.db') script = ScriptDirectory.from_config(cfg) heads = script.get_heads() print('heads', heads) if len(heads) != 1: raise SystemExit(1) PY make typecheck npm run typecheck npm run lint npm test -- src/features/dashboard/components/account-card.test.tsx 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 npm test ``` --- ## Maintainer Refresh - 2026-06-30 # PR 905 Refresh Verification ## Strategy - Refreshed `fix/issue-433-staggered-warmup` by rebasing the existing PR branch onto current `origin/main` (`d9c34b616f218c436a8a235dfbf346b5f7c8bc90`). - Chose rebase because the PR branch was linear and this keeps the existing PR history maintainer-friendly. - Did not push. ## Conflicts Resolved - `app/core/usage/refresh_scheduler.py` - Conflict occurred while applying `fix(warmup): require fresh idle usage samples`. - Resolution preserved current main's one-account-at-a-time usage refresh scheduler and added the PR's `refresh_started_at` timestamp before refreshing the selected account. - The timestamp is passed to `LimitWarmupService.run_after_usage_refresh(...)` so staggered idle warmup still requires an in-cycle fresh usage sample. ## Files Changed By Me During Refresh - `app/core/usage/refresh_scheduler.py` - Manual rebase conflict resolution, now included in rebased commit `a8076d87`. - `app/db/alembic/versions/20260630_000000_add_limit_warmup_staggered_idle.py` - Renamed from `20260603_000000_add_limit_warmup_staggered_idle.py`. - Updated revision id to `20260630_000000_add_limit_warmup_staggered_idle`. - Updated `down_revision` to current main head `20260629_000000_add_dashboard_query_hot_path_indexes`. ## Commands Run - `git fetch origin main` - PASS: fetched current `origin/main`. - `git rebase origin/main` - PASS after resolving one conflict in `app/core/usage/refresh_scheduler.py`. - `uv run alembic heads` - FAIL: plain Alembic config has no `script_location`; replaced with project migration checks below. - `uv run python - <<'PY' ... ScriptDirectory.from_config(...).get_heads() ... PY` - PASS: single Alembic head is `20260630_000000_add_limit_warmup_staggered_idle`. - `uv run python - <<'PY' ... check_migration_policy('sqlite:///unused.sqlite') ... PY` - PASS: `violations= ()`. - `uv run openspec validate limit-warmup-staggered-idle --strict` - PASS: change is valid. - `uv run openspec validate --specs` - PASS: 30 specs passed, 0 failed. - `uv run pytest tests/unit/test_limit_warmup.py tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_migrations.py -q` - PASS: 83 passed, 3 skipped. Skips were PostgreSQL-only migration tests. - `uv run ruff check app/core/usage/refresh_scheduler.py app/db/models.py app/db/alembic/versions/20260630_000000_add_limit_warmup_staggered_idle.py app/modules/limit_warmup/service.py app/modules/settings/api.py app/modules/settings/repository.py app/modules/settings/schemas.py app/modules/settings/service.py tests/unit/test_limit_warmup.py tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_migrations.py` - PASS: all checks passed. - `uv run ty check app/modules/limit_warmup app/core/usage/refresh_scheduler.py app/modules/settings tests/unit/test_limit_warmup.py` - PASS: all checks passed. - `bun run test ...` - FAIL initially: `vitest: command not found` because frontend dependencies were not installed. - `bun run lint ...` - FAIL initially: `eslint: command not found` because frontend dependencies were not installed. - `bun install --frozen-lockfile` - PASS: installed frontend dependencies from existing lockfile. - `bun run test src/features/dashboard/components/account-card.test.tsx src/features/dashboard/components/account-list.test.tsx 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/settings/payload.test.ts src/features/settings/schemas.test.ts` - PASS: 7 test files passed, 69 tests passed. - `bun run lint src/features/dashboard/components/account-card.tsx src/features/dashboard/components/account-card.test.tsx src/features/dashboard/components/account-list.tsx src/features/dashboard/components/account-list.test.tsx src/features/settings/components/routing-settings.tsx src/features/settings/components/routing-settings.test.tsx src/features/settings/components/session-settings.test.tsx src/features/settings/components/settings-page.tsx src/features/settings/components/totp-settings.test.tsx src/features/settings/payload.ts src/features/settings/payload.test.ts src/features/settings/schemas.ts src/features/settings/schemas.test.ts src/test/mocks/factories.ts src/test/mocks/handlers.ts` - PASS. - `bun run typecheck` - PASS: `tsc -b`. - `rg -n "<<<<<<<|=======|>>>>>>>" app tests frontend openspec || true` - PASS for merge-conflict purposes: no conflict markers found; matches were existing separator comments. - `git commit -m "fix(db): refresh staggered warmup migration head"` - PASS: final commit created. ## Final Commit - `a6fc6c65f8299d6a2885bd9a4ea5e62606cd6157` - `fix(db): refresh staggered warmup migration head` ## Remaining Blockers - None known locally. - Branch was not pushed, per instruction.
## Summary - merge the two Alembic heads left after the Soju06#985/Soju06#902/Soju06#905 batch landed on `main` - keep the migration graph single-headed for startup migration upgrade targets ## Validation - `uv run python - <<'PY' ... ScriptDirectory.get_heads()` -> `20260630_010000_merge_warmup_and_request_log_dashboard_heads` - `uv run pytest tests/integration/test_migrations.py -q` -> 12 passed, 3 skipped - `uv run pytest tests/integration/test_migrations.py tests/unit/test_limit_warmup.py tests/unit/test_request_logs_repository.py tests/integration/test_usage_repository.py -q` -> 66 passed, 4 skipped - `uv run ruff check app/db/alembic/versions/20260630_010000_merge_warmup_and_request_log_dashboard_heads.py` -> pass - `git diff --check` -> pass
…Soju06#1230) * fix(warmup): wire exhausted threshold to staggered idle warm-up The staggered idle warm-up feature (PR Soju06#905, issue Soju06#433) never fired in practice because the idle gate required `used_percent == 0.0`, but the upstream ChatGPT API reports a 1.0% floor for idle primary 5h windows. Additionally, the dashboard's "Exhausted at %" setting (`limit_warmup_exhausted_threshold_percent`) was only wired to the regular (post-exhaustion) warm-up path, not to the staggered idle path. The UI places this field in the shared warm-up settings grid beneath the staggered idle toggle, so operators reasonably expect it to control both warm-up modes. Wire `limit_warmup_exhausted_threshold_percent` into `_build_staggered_idle_candidate` so the "Exhausted at %" field controls the idle gate for both warm-up modes. With the default threshold of 99.0%, accounts at or below 99% used are considered idle. Operators can lower this to be more conservative (e.g. 1.0 to only warm truly idle accounts at the upstream floor). * fix(warmup): add separate idle threshold setting for staggered idle warm-up The staggered idle warm-up feature (PR Soju06#905, issue Soju06#433) never fired in practice because the idle gate required `used_percent == 0.0`, but the upstream ChatGPT API reports a 1.0% floor for idle primary 5h windows. Additionally, the dashboard's "Exhausted at %" setting was only wired to the regular (post-exhaustion) warm-up path. The UI places it in the shared warm-up grid, making operators expect it to control both modes. Reusing it for staggered idle would be semantically wrong: 99.0% means "exhausted" for regular warm-up but "almost everything is idle" for staggered idle — opposite semantics. Add a separate `limit_warmup_idle_threshold_percent` setting (default 1.0) that independently controls the staggered idle gate. Add an Alembic migration, wire the new setting into the warm-up service, and add an "Idle at %" input to the dashboard UI beneath the staggered idle toggle. * fix(warmup): redesign warm-up settings UI with separate threshold cards Restructure the warm-up settings panel into two clearly separated side-by-side cards: 'Reset-confirmed warm-up' (with Exhausted at %) and 'Staggered idle warm-up' (with Idle at %). Shared settings (Windows, Model, Cooldown, Prompt) are in a flat grid above. Update tests to enable warm-up before testing limit warm-up controls. * fix(warmup): rename threshold labels to 'Min usage %' and 'Max usage %' Rename the warm-up threshold UI labels for clarity: - 'Exhausted at %' → 'Min usage %' (regular warm-up, default 99) - 'Idle at %' → 'Max usage %' (staggered idle, default 1) The Min/Max prefix makes the direction clear, and 'usage' ties it to the account usage meter already visible on the dashboard. * fix(ui): shorten 'Save warmup model' button to 'Save' The button text 'Save warmup model' is redundant since it sits in the 'Warmup model' section. Shorten to 'Save' to match the limit warm-up section's Save button. * fix(warmup): ignore upstream reset_at timestamp jitter in warm-up gate The reset-confirmed warm-up condition `after.reset_at > before.reset_at` was too sensitive — upstream can report reset_at values that fluctuate by ~1 second between refresh cycles. This caused false warm-up triggers mid-window when 'Min usage %' was set to a low value. Require a minimum 60-second forward jump to confirm a real quota window reset. Add regression test asserting that a 1-second reset_at jitter does not trigger a warm-up. * fix(openspec): sync change artifacts with delivered jitter fix and UI redesign Update proposal to mention the reset_at jitter fix and the side-by-side card UI redesign. Update tasks to include all delivered changes. Fix the reset-confirmed scenario to require a 60-second reset_at jump and add a new scenario for jitter rejection. * fix(warmup): address review feedback — i18n, boundary tests, scoped queries 1. Change idle_threshold_percent default from 0.0 to 1.0 to match the persisted/API contract default and prevent dead-code regression. 2. Move hardcoded English UI strings into i18n (en.json + zh-CN.json) under settings.routing.limitWarmup.resetConfirmed/staggeredIdle. 3. Add 60-second boundary tests: 59s rejected, 60s accepted. 4. Add frontend interaction test for Max usage % input. 5. Add aria-label 'Save warm-up settings' to the limit warm-up Save button and use scoped getByRole queries instead of brittle getAllByRole().at(-1) in tests. * fix(review): separate merged test, move remaining hardcoded strings to i18n Split the accidentally merged test_staggered_idle_warmup_catches_slot_between_refresh_ticks back into its own function. Move remaining hardcoded UI labels (Windows, Model, Cooldown, Prompt) into i18n locales for both en and zh-CN. * fix(db): rebase migration onto origin/main head The new add_dashboard_prohibit_fast_mode migration on origin/main shares the same down_revision. Update our migration to depend on it to maintain a single Alembic head. * fix(warmup): tolerance-based idle dedupe, keep settings visible Address Codex review P2 findings: 1. Staggered idle dedupe: replace stateless bucketing (flooring/midpoint rounding) with tolerance-based deduplication. The repository's try_create_attempt now accepts reset_at_tolerance_seconds and checks for existing attempts within ±5 seconds for primary_idle window only. This handles all jitter boundary cases (18000/18001, 18029/18030, 18059/18060) without any canonicalization or schedule distortion. Regular warm-up attempts keep exact tuple deduplication. 2. Keep warm-up settings visible when limit warm-up is disabled. The previous conditional hid the config fields when warm-up was off, forcing operators to enable first before staging settings. Now the fields are always visible so operators can configure before enabling. Add regression tests: 1-second jitter dedupe, minute-boundary dedupe (18059/18060), and regular warm-up jitter rejection. * fix(db): re-parent warm-up idle threshold migration onto concurrency-caps head Chain the warm-up idle-threshold migration after the account concurrency caps migration (Soju06#1214) so the post-merge Alembic graph stays single-headed: Soju06#1224 (add_account_chatgpt_user_id) -> Soju06#1214 (concurrency caps, 020000) -> this revision (030000). Re-timestamp to 030000 and point down_revision at the concurrency-caps revision. The new column keeps its NOT NULL server_default (1.0) so existing rows backfill, and downgrade drops it. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Soju06 <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]>
Summary
limitWarmupStaggeredIdleEnabledsetting, API field, migration, and dashboard toggleprimary_idleas the 5h window in the dashboardCloses #433.
Maintainer Update
main; current head is1fec57b8717af3e67a50e60d6b51ebd8b24e6b49.20260604_000000_add_reauth_required_account_status, leaving a single head:20260603_000000_add_limit_warmup_staggered_idle.primary_idlerenders as the primary 5h window, idle warm-up requires a fresh usage sample for the account/cycle, and the stagger slot window now follows the configured refresh cadence so nonzero refresh duration does not skip a deterministic slot.Validation
Maintainer Refresh - 2026-06-30
PR 905 Refresh Verification
Strategy
fix/issue-433-staggered-warmupby rebasing the existing PR branch onto currentorigin/main(70576a1eeedc8f41b52548714391ba11167c1f93).Conflicts Resolved
app/core/usage/refresh_scheduler.pyfix(warmup): require fresh idle usage samples.refresh_started_attimestamp before refreshing the selected account.LimitWarmupService.run_after_usage_refresh(...)so staggered idle warmup still requires an in-cycle fresh usage sample.Files Changed By Me During Refresh
app/core/usage/refresh_scheduler.pya8076d87.app/db/alembic/versions/20260630_000000_add_limit_warmup_staggered_idle.py20260603_000000_add_limit_warmup_staggered_idle.py.20260630_000000_add_limit_warmup_staggered_idle.down_revisionto current main head20260629_000000_add_dashboard_query_hot_path_indexes.Commands Run
git fetch origin mainorigin/main.git rebase origin/mainapp/core/usage/refresh_scheduler.py.uv run alembic headsscript_location; replaced with project migration checks below.uv run python - <<'PY' ... ScriptDirectory.from_config(...).get_heads() ... PY20260630_000000_add_limit_warmup_staggered_idle.uv run python - <<'PY' ... check_migration_policy('sqlite:///unused.sqlite') ... PYviolations= ().uv run openspec validate limit-warmup-staggered-idle --strictuv run openspec validate --specsuv run pytest tests/unit/test_limit_warmup.py tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_migrations.py -quv run ruff check app/core/usage/refresh_scheduler.py app/db/models.py app/db/alembic/versions/20260630_000000_add_limit_warmup_staggered_idle.py app/modules/limit_warmup/service.py app/modules/settings/api.py app/modules/settings/repository.py app/modules/settings/schemas.py app/modules/settings/service.py tests/unit/test_limit_warmup.py tests/integration/test_settings_api.py tests/integration/test_settings_audit_changed_fields.py tests/integration/test_migrations.pyuv run ty check app/modules/limit_warmup app/core/usage/refresh_scheduler.py app/modules/settings tests/unit/test_limit_warmup.pybun run test ...vitest: command not foundbecause frontend dependencies were not installed.bun run lint ...eslint: command not foundbecause frontend dependencies were not installed.bun install --frozen-lockfilebun run test src/features/dashboard/components/account-card.test.tsx src/features/dashboard/components/account-list.test.tsx 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/settings/payload.test.ts src/features/settings/schemas.test.tsbun run lint src/features/dashboard/components/account-card.tsx src/features/dashboard/components/account-card.test.tsx src/features/dashboard/components/account-list.tsx src/features/dashboard/components/account-list.test.tsx src/features/settings/components/routing-settings.tsx src/features/settings/components/routing-settings.test.tsx src/features/settings/components/session-settings.test.tsx src/features/settings/components/settings-page.tsx src/features/settings/components/totp-settings.test.tsx src/features/settings/payload.ts src/features/settings/payload.test.ts src/features/settings/schemas.ts src/features/settings/schemas.test.ts src/test/mocks/factories.ts src/test/mocks/handlers.tsbun run typechecktsc -b.rg -n "<<<<<<<|=======|>>>>>>>" app tests frontend openspec || truegit commit -m "fix(db): refresh staggered warmup migration head"Final Commit
a6fc6c65f8299d6a2885bd9a4ea5e62606cd6157-fix(db): refresh staggered warmup migration headRemaining Blockers