Skip to content

[Feature]: make manual reset-credit retries use durable operation identity #2275

Description

@luvs01

Area

Authentication and account pool

What are you trying to accomplish?

Make an explicit manual reset-credit redemption safely retryable across an ambiguous upstream result or process restart by reusing one durable operation identity.

What prevents this today?

On current dev, POST /api/codex-auth/reset-credits/consume creates a fresh crypto.randomUUID() inside every request and sends it as redeem_request_id. It does not reserve an identity in the ledger from #1829, record a post-dispatch ambiguous outcome, or return an already-settled terminal result.

#657 is closed as not planned, and the broader #1526 and dormant-policy #1624 pull requests are closed. No active issue currently owns manual-ledger activation.

What should OpenCodex do?

  • Bind each confirmed manual redemption intent to one caller-stable canonical UUIDv4.
  • Call openManualResetCreditOperation before upstream dispatch.
  • Use the ledger-returned canonical operation ID as redeem_request_id.
  • Make identity mismatch, capacity, unavailable, and stored-terminal outcomes perform no new upstream dispatch.
  • Mark uncertain post-dispatch outcomes ambiguous.
  • Durably settle reset, already_redeemed, nothing_to_reset, and no_credit before returning the terminal response.
  • Preserve the same identity through supported CLI/GUI retry and process restart behavior.
  • Add end-to-end regressions proving no duplicate dispatch after ambiguity, restart, concurrent retry, identity mismatch, or stored terminal state.
  • Preserve the existing authorization boundary; do not add automatic, background, scheduled, or Responses-triggered redemption in this issue.
  • Keep the ledger internal; no package-root export is required for this consumer.

Activation implementation owner: @luvs01.

Activation still requires CODEOWNER/maintainer review. /src/codex/ is owned by @lidge-jun and @Ingwannu. Any later Responses-core integration requires @lidge-jun specifically.

Example usage or interface

POST /api/codex-auth/reset-credits/consume
Content-Type: application/json

{
  "accountId": "<account-id>",
  "operationId": "00000000-0000-4000-8000-000000000001"
}

A retry of the same confirmed intent sends the same operationId and either resumes the same durable operation or returns its stored terminal result.

Alternatives or workarounds

Minting a new server-side UUID for every retry cannot distinguish a new intent from recovery of an ambiguous prior dispatch. Reopening #1526 would also revive its stale ledger, consent, GUI, API, and documentation bundle. #822 remains a separate proactive scheduling feature.

Additional context

Checks

  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolOAuth, credentials, Codex pool, quota, failover, plansenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions