Clarify provider ownership and compatibility decisions in the development workflow. Document the active API, SDK, deployment and migration contracts, and keep version history in release notes.
Co-authored-by: Codex <noreply@openai.com>
Use account-scoped model capabilities for discovery and routing. Let each provider project external prices and declare which credentials support quota refresh. Share alias resolution and preserve xAI adapter and account affinity decisions.
Align OAuth flow handling, protocol feature detection, Retry-After parsing, and plugin package and stream validation with their owning contracts.
Co-authored-by: Codex <noreply@openai.com>
Keep account-change dispatch shared and let each provider own its settings and quota query targets. Reuse verified account catalogs on credential changes and clarify provider ownership in the development guide.
BREAKING CHANGE: settings clients must use the provider-scoped settings map. Migration 0055 discards the RC Antigravity refresh preference and restores the provider default.
Co-authored-by: Codex <noreply@openai.com>
Confirm the request still uses the current access token before resetting transient feedback across credential revisions. Track the latest 401 independently from Cloudflare streaks so an overlapping failure cannot suppress or be erased by a successful request.
Co-authored-by: Codex <noreply@openai.com>
* fix(openai): refresh OAuth tokens rejected before expiry
A 401 on a model request marked a refreshable OAuth account Expired when
its access token had not reached its expiry. Expired accounts are left out
of both selection and scheduled refresh, so the account stayed out of
rotation until it was refreshed by hand, even though the refresh token was
still valid.
Expire the rejected access token instead and let the OAuth worker renew
it, as quota refresh already does for token_revoked. A renewed token that
is rejected again before any successful request still marks the account
Expired.
Constraint: Accounts without a refresh token or a known expiry keep the existing Expired outcome
Rejected: Match the "status=503" text inside the 401 body | free-text matching, and other 401s on unexpired tokens would still strand the account
Rejected: Refresh on every 401 without a bound | an account whose renewed tokens keep failing would refresh in a loop
Confidence: high
Scope-risk: narrow
Tested: Rust 1.99.1 fmt --check; clippy -p provider-openai --all-targets --all-features -D warnings; provider-openai tests (1264 passed); the new selector case and the adapter case fail without the selector change
Not-tested: A live upstream 401 against this build; workspace-wide clippy and tests are left to CI
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* fix(openai): preserve OAuth recovery across concurrent feedback
Report success from native endpoints and upstream adapters, and keep stale
responses from clearing the current OAuth recovery bound. Serialize model
401 and Cookie feedback with token refresh through the account lease.
Recheck credential revisions after acquiring scheduled and manual refresh
leases so a queued snapshot cannot resend an already rotated refresh token.
Cookie feedback skips writes while refresh owns the lease; a later response
can capture cookies without discarding successfully exchanged tokens.
Validated: workspace fmt and strict Clippy; 1265 provider-openai tests;
48 gateway architecture and bootstrap tests. Real upstream and store service
integration remain for live verification and CI.
Co-authored-by: Codex <noreply@openai.com>
* fix(openai): retain token recovery across cookie revisions
Use the access token and revision that were sent upstream to recognize a successful OAuth request after a concurrent cookie write. Keep account and quota recovery fenced by revision, and preserve newer rejection records and replies from superseded tokens.
Co-authored-by: Codex <noreply@openai.com>
* fix(openai): preserve account feedback across cookie writes
Reset consecutive Cloudflare failures on a successful request using the current access token. Keep quota and account state fenced by the response revision. A model 401 can shorten expiry while the cookie writer holds the refresh lease; a conflicting write is retried only for the same token.
Co-authored-by: Codex <noreply@openai.com>
* test(openai): separate risk counters from OAuth rejection
Verify that a successful request using the rejected token breaks a path-block streak without allowing a refreshed token to be rejected indefinitely.
Co-authored-by: Codex <noreply@openai.com>
---------
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: Zyy <zyycn@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Reject subsequent reads after outbound bodies exceed capacity, reuse Client Key cursor wire types, and simplify protocol fixtures.
Clarify current API contracts, module ownership, and local test setup.
Co-authored-by: Codex <noreply@openai.com>
Project known response items and nested content for history matching without changing forwarded payloads. Preserve client tool-result metadata and compare unknown variants verbatim.
Add version-pinned replay fixtures and multi-turn outbound regression coverage.
Co-authored-by: Codex <noreply@openai.com>
Pair ID-less calls and results by tool name and GenAI ordering when
counts match. Preserve ambiguous groups and existing raw JSON fields.
Co-authored-by: Zyy <zyycn@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Use a 30-second idle timeout for account retries and manual refreshes while keeping ordinary discovery bounded. Let the admin UI wait for these refreshes until completion or cancellation.
Co-authored-by: Zyy <zyycn@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Preserve session scheduling and retry hints while a model cools down. Show active model limits and their recovery times in the account list.
Co-authored-by: Codex <noreply@openai.com>
Support named independent tool outputs and flatten custom grammar formats.
Adapt Codex search aliases, long call IDs and tool names while preserving
history pairing and restoring client-visible names in JSON and SSE.
Refs #843
Co-authored-by: Zyy <zyycn@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Derive changelists from official client artifacts and publish them with the
matching version only after verification. Restore profiles from the shared
cache at startup and check release metadata hourly.
Filter gateway fingerprint status from OAuth requests and recognize structured
workspace policy denials without changing unrelated request data.
Co-authored-by: Codex <noreply@openai.com>
Preserve RPC status, ErrorInfo reasons and retry hints across generation,
token counting and resource queries. Isolate confirmed account denials,
keep verification links in diagnostics, and preserve access state during
token refresh.
Cover in-band and streaming failures, background query suppression and
stale credential feedback with regression tests.
Refs #836
Co-authored-by: Codex <noreply@openai.com>
* fix(gateway): resolve fast policy from the account's hit group
Bound-group fast policies were merged once per API key at snapshot
compile time, so a disabled or forced group on the same key leaked its
policy onto accounts that only belong to other enabled groups. Keep the
per-group policies frozen on the account scope, skip disabled groups
when merging, and resolve the effective fast mode from the account the
request actually hit, falling back to the key-level merged value only
when the account matches no enabled bound group.
* ci: retrigger checks
* style(gateway): rustfmt the account-scoped fast mode helper
* fix(routing): scope Fast policy to selected eligible groups
Co-authored-by: Codex <noreply@openai.com>
* fix(routing): preserve explicit default Fast overrides
Co-authored-by: Codex <noreply@openai.com>
---------
Co-authored-by: Zyy <zyycn@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Match privacy-processed SSE requests against the existing WebSocket history prefix. Keep full input on a mismatch and resume trimming after a matching completed turn.
Record body receipt, authentication, decompression, decoding and execution preparation timings to distinguish ingress delays from upstream latency.
Cover metadata, body and header privacy across reuse, mismatch and resumed reuse.
Co-authored-by: Codex <noreply@openai.com>
Treat explicit null text as empty in Chat content blocks and preserve user input, tool results, and cache breakpoints during conversion. Resolve nullable format and reasoning controls consistently with routing, and forward stop sequences to Messages and GenAI.
Co-authored-by: Codex <noreply@openai.com>
Share the four Codex request ID headers across HTTP, WebSocket, diagnostics, and continuation failures. Preserve current-failure IDs and the model execution ID fallback, and remove unsupported aliases.
Update regression coverage and the public API contract.
Co-authored-by: Codex <noreply@openai.com>
Include recent request pressure in Smart load scores before near-best
selection, keeping the concurrency penalty independent. Remove the
separate recent-count filter and share the score with diagnostics and
queue selection.
Co-authored-by: Codex <noreply@openai.com>
Prefer accounts with fewer recent requests among near-best Smart candidates
while preserving affinity and existing eligibility constraints. Save recent
load snapshots asynchronously to Redis and restore live buckets on startup.
Co-authored-by: Zyy <zyycn@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Return an unknown version when discovery fails and preserve local update capability during rate limits. Keep release notes tied to the selected channel and require a higher version for installation.
Co-authored-by: Codex <noreply@openai.com>
Keep header and stream quota facts tied to their collection time so delayed responses cannot replace a newer refresh. Filter stale observations again on merge conflicts and retain timestamps through failure and warmup paths.
Co-authored-by: Codex <noreply@openai.com>
* feat(accounts): add xAI and Antigravity API key upstreams
Support native Responses and GenAI API key accounts with custom upstream URLs.
Reuse account management and isolate credentials, catalogs, and runtime connections by revision.
Refs #814
Co-authored-by: Codex <noreply@openai.com>
* refactor(antigravity): simplify API key account names
Use name consistently in API key account documents and verify the exported contract before reimport.
Co-authored-by: Codex <noreply@openai.com>
---------
Co-authored-by: Zyy <zyycn@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
* fix(openai): start weekly bucket warmup after reset-credit consume
After a successful reset or already_redeemed consume, refresh quota and
advance an already-enabled bucket warmup to the actual reset time. Pull
an early reset's registered future boundary back so due() is not blocked
until the original window ends. Keep the five-minute recheck and skip
warmup when the new round already has usage.
* fix(openai): make credit-triggered weekly warmup idempotent
Register confirmed redemptions with bucket progress and recheck usage in the warmup worker. Preserve precise usage evidence and keep rolling quota deadlines separate from confirmed resets.
Co-authored-by: Codex <noreply@openai.com>
* refactor(openai): keep only the latest warmup redemption
Reuse account warmup progress to recognize retries of the latest credit. Remove the receipt table and keep the existing storage contract.
Co-authored-by: Codex <noreply@openai.com>
---------
Co-authored-by: Zyy <zyycn@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Use the empty country policy and leave residency and account routing unset.
Migrate existing follow-location policies and us residency values while
preserving custom settings and advancing the settings revision.
Update the settings UI, existing contract tests, and deployment guidance.
Co-authored-by: Codex <noreply@openai.com>
Recognize known Claude and Gemini signature envelopes without wrapping
response signatures. Remove foreign thinking history while preserving
compatible or unknown signatures, ordinary text, and tool history.
Integrate cleanup into request field editing and reuse unchanged history.
Keep counting and unknown model families untouched, without session caches.
Cover native JSON/SSE, escaped fields, malformed envelopes, and model
switches; document recognition and account compatibility boundaries.
Co-authored-by: Codex <noreply@openai.com>
Pair uniquely named calls and results in adjacent model/user turns before
sending native Claude requests. Preserve existing IDs and raw business
fields, avoid ID collisions, and leave ambiguous history unchanged.
Cover JSON/SSE transport, partial IDs, replay stability, and scope limits.
Co-authored-by: Zyy <zyycn@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
Start the confirmation deadline after the cancellation frame is written. Arbitrate acknowledgements and expiry in the reader and commit failures under the call table lock. Cover queued cancellation under backpressure and recovery at the default in-flight limit.
Co-authored-by: Codex <noreply@openai.com>
Align the Grok 1.0.92 transport profile, retain only continuation routing metadata, and filter downstream environment headers at provider boundaries.
Co-authored-by: Codex <noreply@openai.com>