feat: manage credential model availability - #51
Conversation
782845a to
3274f9e
Compare
There was a problem hiding this comment.
💡 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".
3274f9e to
5264eda
Compare
There was a problem hiding this comment.
💡 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".
5264eda to
ae2ade0
Compare
There was a problem hiding this comment.
💡 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".
| await getModelsForCredentials( | ||
| await listEligibleCredentialRecords(accessKey?.credentialFilenames), | ||
| ) |
There was a problem hiding this comment.
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 👍 / 👎.
| return { | ||
| ...current, | ||
| model: models.includes(current.model) | ||
| ? current.model | ||
| : (models[0] ?? ''), |
There was a problem hiding this comment.
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 Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
ae2ade0 to
8d3906c
Compare
There was a problem hiding this comment.
💡 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".
| listCredentials(), | ||
| getCurrentCredentialInfo(), | ||
| getModelsForCredentials(eligibleCredentials), | ||
| getModelsByCredential(eligibleCredentials), |
There was a problem hiding this comment.
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 👍 / 👎.
| export const getDefaultModel = async (fallback = 'glm-5.1'): Promise<string> => | ||
| fallback; |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
Validation