Skip to content

feat(codex): hydrate account models from chatgpt backend#4913

Closed
agustif wants to merge 1 commit into
earendil-works:mainfrom
agustif:codex/openai-codex-account-model-hydration-20260523
Closed

feat(codex): hydrate account models from chatgpt backend#4913
agustif wants to merge 1 commit into
earendil-works:mainfrom
agustif:codex/openai-codex-account-model-hydration-20260523

Conversation

@agustif
Copy link
Copy Markdown

@agustif agustif commented May 23, 2026

Summary

  • hydrate the OpenAI Codex model catalog from the live ChatGPT backend for the logged-in account
  • thread async model hydration through model registry, startup, model listing, interactive selection, RPC, and session restore flows
  • add tests for live catalog filtering/merging and registry hydration behavior

Testing

  • npm --workspace packages/ai test -- openai-codex-models.test.ts
  • npm --workspace packages/coding-agent test -- model-registry.test.ts

Notes

  • adds PI_OPENAI_CODEX_CLIENT_VERSION override for backend-gated model version negotiation
  • did not use full packages/coding-agent build as the merge base had unrelated workspace/type-resolution issues outside this patch

@github-actions
Copy link
Copy Markdown
Contributor

This PR was auto-closed. Only contributors approved with lgtm can open PRs. Open an issue first.

Maintainers review auto-closed issues daily. Issues that do not meet the quality bar in CONTRIBUTING.md will not be reopened or receive a reply.

If a maintainer replies lgtmi, your future issues will stay open. If a maintainer replies lgtm, your future issues and PRs will stay open.

See CONTRIBUTING.md.

@github-actions github-actions Bot closed this May 23, 2026
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: 0ce0472b90

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

}

this.hydrationPromise = (async () => {
let hydrated = this.baseModels;
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 Preserve dynamically registered providers during hydration

hydrateAvailableModels() rebuilds from this.baseModels, which is only set in loadModels() and does not include models later added via registerProvider(). After any extension/runtime provider registration, a hydration call will overwrite this.models with that stale base list and drop the dynamically registered provider models. This regression is user-visible now that hydration is invoked in startup/session flows, so extension-provided models can disappear from selection and resolution.

Useful? React with 👍 / 👎.

return cached.models;
}

const response = await fetch(OPENAI_CODEX_MODELS_URL, {
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 Add a timeout to catalog fetch used in model hydration

The account catalog request is awaited without an abort signal or timeout, and hydration is now called on critical paths (startup/session/model resolution). If chatgpt.com/backend-api/codex/models stalls at the TCP/HTTP layer, the CLI can block for an extended network timeout before falling back, despite hydration being treated as best-effort. Adding a bounded timeout (for example via AbortSignal.timeout(...)) avoids long startup hangs.

Useful? React with 👍 / 👎.

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.

1 participant