Skip to content

fix(ai): read the assistant model from the account login - #4886

Open
paultranvan wants to merge 1 commit into
masterfrom
fix/assistant-model-update
Open

fix(ai): read the assistant model from the account login#4886
paultranvan wants to merge 1 commit into
masterfrom
fix/assistant-model-update

Conversation

@paultranvan

@paultranvan paultranvan commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

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.login and the API key in auth.password, and the stack encrypts the two together into auth.credentials_encrypted. That blob is only rebuilt when a password is 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 — while auth.login is correctly updated.

So the old model was forwarded to OpenRAG in metadata.llm_override.

Fix

The plain login is never encrypted (encryptMap copies 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.login already holds the right value on existing accounts, so every assistant is fixed as soon as this is deployed.

The account's name field has the same staleness (ComputeName only runs in createAccount, so name keeps 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.

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
paultranvan force-pushed the fix/assistant-model-update branch from 1f9c777 to 2280bd1 Compare July 29, 2026 16:16
@paultranvan
paultranvan marked this pull request as ready for review July 29, 2026 16:16
@shepilov

Copy link
Copy Markdown
Member

Does it make sense not to store a model in auth.login at all?

@shepilov

Copy link
Copy Markdown
Member

And how we update the model in the account info?

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