Skip to content

Add Codex reset-credit redemption flow - #6361

Merged
diegosouzapw merged 6 commits into
diegosouzapw:release/v3.8.46from
JxnLexn:feat/codex-reset-credits
Jul 7, 2026
Merged

diegosouzapw merged 6 commits into
diegosouzapw:release/v3.8.46from
JxnLexn:feat/codex-reset-credits

Conversation

@JxnLexn

@JxnLexn JxnLexn commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add a Codex reset-credit redemption path to usage limits, including the UI action, backend consumption flow, and refreshed quota display after redemption.

Validation

  • npm run lint
  • npm run test:unit
  • npm run test:coverage
  • Coverage is still >= 60% for statements, lines, functions, and branches
  • SonarQube PR analysis is green or any remaining issues are explicitly documented below

Tests Added Or Updated

  • src/lib/usage/__tests__/codexResetCredits.test.ts
  • src/lib/usage/__tests__/providerLimits.test.ts
  • src/lib/usage/__tests__/providerLimits.public-api.test.ts

Coverage Notes

  • Added coverage for the Codex reset-credit consume flow, quota parsing, and the Provider Limits wiring that exposes the action in the UI.

Reviewer Notes

  • The flow calls an upstream Codex consume endpoint, uses an idempotency key, and refreshes stored usage after success. Manual validation against a Codex OAuth connection is recommended.

@JxnLexn
JxnLexn requested a review from diegosouzapw as a code owner July 6, 2026 13:42

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82b112632d

ℹ️ 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".

Comment thread src/lib/usage/codexResetCredits.ts Outdated
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c050ad4e5b

ℹ️ 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".

connection: CodexConnectionLike,
idempotencyKey: string
): Promise<{ connection: CodexConnectionLike; response: Response }> {
let refreshedConnection = await refreshCodexConnectionIfNeeded(connection);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Refresh Codex tokens through the assigned proxy

This refresh runs before either fetchResetCredits or postConsumeResetCredit enters runWithProxyContext; for a Codex connection with an account-level proxy and an expired/401 access token, the OAuth refresh egresses directly while the reset-credit requests use the proxy. That can fail or violate the pinned egress expected for proxy-bound accounts, leaving redeem unusable in exactly the stale-token path this retry handles; wrap refreshAndUpdateCredentials in the same resolveProxyForConnection/runWithProxyContext path.

Useful? React with 👍 / 👎.

Kept the release 'Banked Reset Credits' label (reverted the PR's cosmetic rename that broke provider-columns/provider-limits-ui tests).

Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
@diegosouzapw
diegosouzapw merged commit 958260a into diegosouzapw:release/v3.8.46 Jul 7, 2026
1 check was pending
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw

Copy link
Copy Markdown
Owner

Merged into release/v3.8.46 — thank you, @JxnLexn! 🙌

diegosouzapw added a commit that referenced this pull request Jul 7, 2026
…uick pre-flight

The heavy release-PR CI (jobs the local --quick pre-flight does not run) surfaced
five inherited base-reds:
- route-validation:t06 — src/app/api/usage/codex-reset-credit/route.ts (#6361) read
  request.json() with no Zod validation; add CodexResetCreditBodySchema.safeParse
  with a 400 on invalid body (behavior only tightened, downstream logic untouched).
- GOLDEN provider translate-path — regenerate the snapshot for the new zed-hosted
  provider (purely additive, no existing provider path changed).
- vscode raw-models test — #6241 additively emits supportsThinking + effort_tiers on
  the models catalog; align the deepEqual expected (no assert removed, 37/37).
- docs-counts (Docs-Sync-Strict --strict) — refresh stale counts to code: 75 executors
  (ARCHITECTURE, CODEBASE_DOCUMENTATION), 19 OAuth providers (ARCHITECTURE), 18 combo
  strategies incl. the #6396 pipeline strategy (RESILIENCE_GUIDE, AUTO-COMBO, CLAUDE.md).
This was referenced Jul 7, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
Codex reset-credit redemption flow (diegosouzapw#6361). Tests 56/56; kept release 'Banked Reset Credits' label (reverted cosmetic rename that broke 2 release tests). Integrated into release/v3.8.46.
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…uick pre-flight

The heavy release-PR CI (jobs the local --quick pre-flight does not run) surfaced
five inherited base-reds:
- route-validation:t06 — src/app/api/usage/codex-reset-credit/route.ts (diegosouzapw#6361) read
  request.json() with no Zod validation; add CodexResetCreditBodySchema.safeParse
  with a 400 on invalid body (behavior only tightened, downstream logic untouched).
- GOLDEN provider translate-path — regenerate the snapshot for the new zed-hosted
  provider (purely additive, no existing provider path changed).
- vscode raw-models test — diegosouzapw#6241 additively emits supportsThinking + effort_tiers on
  the models catalog; align the deepEqual expected (no assert removed, 37/37).
- docs-counts (Docs-Sync-Strict --strict) — refresh stale counts to code: 75 executors
  (ARCHITECTURE, CODEBASE_DOCUMENTATION), 19 OAuth providers (ARCHITECTURE), 18 combo
  strategies incl. the diegosouzapw#6396 pipeline strategy (RESILIENCE_GUIDE, AUTO-COMBO, CLAUDE.md).
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
Codex reset-credit redemption flow (diegosouzapw#6361). Tests 56/56; kept release 'Banked Reset Credits' label (reverted cosmetic rename that broke 2 release tests). Integrated into release/v3.8.46.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants