Skip to content

[codex] Auto provision AIProxy key#9

Merged
Che-Zhu merged 1 commit intomainfrom
codex/add-ai-provider
May 8, 2026
Merged

[codex] Auto provision AIProxy key#9
Che-Zhu merged 1 commit intomainfrom
codex/add-ai-provider

Conversation

@Che-Zhu
Copy link
Copy Markdown
Collaborator

@Che-Zhu Che-Zhu commented May 7, 2026

Summary

  • Add automatic AIProxy token provisioning from Sealos kubeconfig.
  • Persist a user-scoped aiproxy key idempotently without overwriting existing configuration.
  • Gate task creation entry points on shared client-side provisioning and use the /v1 AIProxy model base URL.

Validation

  • pnpm format:check
  • pnpm type-check
  • pnpm lint (0 errors, existing warnings remain)
  • pnpm exec tsx scripts/verify-aiproxy-provisioning.ts

Notes

  • expired_at is ignored because the live token lookup response may omit it.
  • The API returns diagnostic enums for provisioning failures without logging token or kubeconfig values.

@Che-Zhu Che-Zhu marked this pull request as ready for review May 8, 2026 02:29
@Che-Zhu Che-Zhu merged commit 041043a into main May 8, 2026
5 checks passed
Copy link
Copy Markdown

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

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: 6be71a0c71

ℹ️ 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 on lines +106 to +110
const isAiProxyProvisioned = await ensureAiProxyProvisioned()

if (!isAiProxyProvisioned) {
toast.error('Failed to prepare AIProxy configuration')
return
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Skip mandatory AIProxy provisioning before task creation

This new early-return blocks task creation whenever ensureAiProxyProvisioned() fails, even though task execution can still succeed via the existing AI Gateway fallback path (resolveCodexGatewayFromApiKeys uses AI_GATEWAY_API_KEY when no AIProxy key is present). In environments where Sealos session/kubeconfig is unavailable (or temporarily fails), users now get a hard client-side stop instead of creating a valid task, so provisioning should be conditional rather than mandatory.

Useful? React with 👍 / 👎.

Comment on lines +117 to +119
if (lookupResponse.status === 200) {
return await parseUsableToken(lookupResponse)
}
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 Retry token creation when lookup returns masked token

The 200 lookup path returns immediately, but validation rejects masked keys (masked_key), and the included token-management API reference documents masked keys for GET /tokens/{name} responses. That means if the upstream token already exists but the local DB row is missing, provisioning deterministically fails with unusable_token and never reaches the idempotent create endpoint that can return a usable key, leaving users unable to reprovision.

Useful? React with 👍 / 👎.

@Che-Zhu Che-Zhu deleted the codex/add-ai-provider branch May 8, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant