Skip to content

feat: manage credential model availability - #51

Merged
orangeboyChen merged 1 commit into
mainfrom
codex/dynamic-credential-models
Jul 23, 2026
Merged

feat: manage credential model availability#51
orangeboyChen merged 1 commit into
mainfrom
codex/dynamic-credential-models

Conversation

@orangeboyChen

@orangeboyChen orangeboyChen commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • discover and persist supported models per credential across file, SQLite, and PostgreSQL storage
  • expose per-credential model refresh and automatic model saves in Settings
  • refresh eligible credentials missing saved models when the application starts
  • return saved models for the selected credential in model APIs and API Test
  • fix cache-hit aggregation, DebugView output-token TPS, responsive navigation, and small-screen credential rendering

Validation

  • bun run lint
  • bun run format:check
  • bun run typecheck
  • bun run test:coverage
  • bun run test:ci
  • bun run build

@orangeboyChen
orangeboyChen force-pushed the codex/dynamic-credential-models branch from 782845a to 3274f9e Compare July 22, 2026 16:29
@orangeboyChen
orangeboyChen marked this pull request as ready for review July 22, 2026 16:35

@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: 3274f9e3cc

ℹ️ 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 app/credentials/credentials.tsx Outdated
Comment thread app/page-shell.tsx
@orangeboyChen
orangeboyChen force-pushed the codex/dynamic-credential-models branch from 3274f9e to 5264eda Compare July 22, 2026 17:48
@orangeboyChen orangeboyChen changed the title feat: discover models from credentials feat: manage credential model availability Jul 22, 2026

@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: 5264eda495

ℹ️ 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 app/admin-api/credentials/models/route.ts Outdated
@orangeboyChen
orangeboyChen force-pushed the codex/dynamic-credential-models branch from 5264eda to ae2ade0 Compare July 22, 2026 18:11
@orangeboyChen
orangeboyChen enabled auto-merge (squash) July 22, 2026 18:12

@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: ae2ade0e63

ℹ️ 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 +1287 to +1289
await getModelsForCredentials(
await listEligibleCredentialRecords(accessKey?.credentialFilenames),
)

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 Filter credential rotation by requested model

When an access key is bound to credentials with different supported_models, this advertises the union for that key, but the chat/responses proxy still resolves credentials by round-robin or affinity without considering the requested model. A client can select a model returned by /v1/models and then be routed to another bound credential that does not support it, producing avoidable upstream failures; either make proxy credential selection model-aware or only advertise models that are safe across the bound set.

Useful? React with 👍 / 👎.

Comment thread app/page-shell.tsx
Comment on lines +548 to +552
return {
...current,
model: models.includes(current.model)
? current.model
: (models[0] ?? ''),

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 Ignore stale model refreshes after credential switches

If the user switches from credential A to B while A's model refresh is still in flight, the slower A response still runs this updater and rewrites apiTest.model even though current.credentialFilename may already be B. That leaves the API test submitting credential B with credential A's model; check the current selected filename before applying a refresh result for a specific filename.

Useful? React with 👍 / 👎.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.83099% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.03%. Comparing base (886b285) to head (8d3906c).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #51      +/-   ##
==========================================
+ Coverage   91.88%   92.03%   +0.14%     
==========================================
  Files          19       20       +1     
  Lines        7887     8131     +244     
  Branches     1566     1624      +58     
==========================================
+ Hits         7247     7483     +236     
- Misses        628      635       +7     
- Partials       12       13       +1     
Flag Coverage Δ
unittests 92.03% <96.83%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@orangeboyChen
orangeboyChen force-pushed the codex/dynamic-credential-models branch from ae2ade0 to 8d3906c Compare July 23, 2026 02:03
@orangeboyChen
orangeboyChen merged commit b624efa into main Jul 23, 2026
5 checks passed
@orangeboyChen
orangeboyChen deleted the codex/dynamic-credential-models branch July 23, 2026 02:07

@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: 8d3906ca4d

ℹ️ 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 app/page-loader.ts
listCredentials(),
getCurrentCredentialInfo(),
getModelsForCredentials(eligibleCredentials),
getModelsByCredential(eligibleCredentials),

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 Preserve saved models during API-test hydration

When the API-test tab is opened for a credential that already has persisted supported_models, this still hydrates the per-credential map through getModelsByCredential(), which performs live discovery and returns an explicit empty models array on transient upstream failure or timeout. page-shell then treats initialData.credentialModels[filename] as authoritative, so the model dropdown for that credential is empty even though getModelsForCredentials() had the saved list; hydrate this map from saved supported models and leave live discovery to an explicit refresh.

Useful? React with 👍 / 👎.

Comment on lines +171 to +172
export const getDefaultModel = async (fallback = 'glm-5.1'): Promise<string> =>
fallback;

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 Derive the default model from eligible credentials

When a /v1/chat/completions or /v1/responses client omits model, the proxy still calls getDefaultModel(), but after removing the model setting this always returns glm-5.1. For credentials whose discovered/supported models do not include glm-5.1, /v1/models advertises the real list while omitted-model requests are sent upstream with an unsupported hard-coded model; choose the first eligible credential model or reject missing models instead of returning a fixed fallback.

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.

2 participants