fix(ai): read the assistant model from the account login - #4886
Open
paultranvan wants to merge 1 commit into
Open
fix(ai): read the assistant model from the account login#4886paultranvan wants to merge 1 commit into
paultranvan wants to merge 1 commit into
Conversation
The account's encrypted credentials hold the (login, password) pair, and the stack only rebuilds them when a password is sent. Editing an assistant's model without retyping its API key therefore leaves them on the previous model, while the plain `login` is correctly updated. buildLLMOverride preferred the encrypted blob, so such an edit had no effect: the conversation kept running on the model the assistant was created with. Read the model from `login`, and use the blob only for the API key, keeping its login as a fallback for accounts written before the login was kept in clear.
paultranvan
force-pushed
the
fix/assistant-model-update
branch
from
July 29, 2026 16:16
1f9c777 to
2280bd1
Compare
paultranvan
marked this pull request as ready for review
July 29, 2026 16:16
Member
|
Does it make sense not to store a model in auth.login at all? |
Member
|
And how we update the model in the account info? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Changing an AI assistant's model has no effect unless the API key is retyped at the same time: the conversation keeps running on the model the assistant was created with.
The provider account stores the model in
auth.loginand the API key inauth.password, and the stack encrypts the two together intoauth.credentials_encrypted. That blob is only rebuilt when apasswordis present in the incoming document (encryptMap,model/account/credentials.go). Editing only the model sends no password, so the blob survives untouched, still encrypting the previous model — whileauth.loginis correctly updated.So the old model was forwarded to OpenRAG in
metadata.llm_override.Fix
The plain
loginis never encrypted (encryptMapcopies it as-is) and is always up to date, so it now wins. The encrypted blob is used only for the API key, and its login is kept as a model fallback for accounts written before the login was kept in clear.Impact
No migration needed:
auth.loginalready holds the right value on existing accounts, so every assistant is fixed as soon as this is deployed.The account's
namefield has the same staleness (ComputeNameonly runs increateAccount, sonamekeeps the model of the day the assistant was created). It is cosmetic — nothing reads it for these accounts — and is handled separately on the client side.