# agent: Preserve saved model selection until provider loads \(\#59417\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/080838387a76b3ea7fc841c8cabfd1ac00a7e444)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 080838387a76b3ea7fc841c8cabfd1ac00a7e444

Requested commit: 080838387a76b3ea7fc841c8cabfd1ac00a7e444

Commit: 080838387a76b3ea7fc841c8cabfd1ac00a7e444

Tree: d0fef40a070fbb88da2d7fb7d2b72feacb78eb72

Author: Neel

Committer: GitHub

## Message

```
agent: Preserve saved model selection until provider loads (#59417)

This PR fixes a bug where a thread could fall back to a BYOK model when
a remote provider hasn't yet returned its list of available models. On a
cold start, a thread previously using a Cloud model would fall over to a
BYOK model (if a key is defined) because Cloud models aren't loaded yet.

Note: there is a small behaviour change here, where previously the
priority was `default_model → profile_model → default_model`. The new
order is `profile_model → default_model`.

Release Notes:

- Improved saved thread model selection for cloud-based providers
```

## Parents

- [e45e42af6e6e7f2c644875c8b78ebbc237ee6e70](https://git.cafe/gitcafe/zed/commit/e45e42af6e6e7f2c644875c8b78ebbc237ee6e70?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/080838387a76b3ea7fc841c8cabfd1ac00a7e444?format=markdown)
