Skip to content

Clear LLM token and model list on sign out - #57724

Merged
osyvokon merged 5 commits into
mainfrom
clear-llm-token
Jun 3, 2026
Merged

Clear LLM token and model list on sign out#57724
osyvokon merged 5 commits into
mainfrom
clear-llm-token

Conversation

@osyvokon

@osyvokon osyvokon commented May 26, 2026

Copy link
Copy Markdown
Contributor

Closes #FR-20

Release Notes:

  • Fixed Zed provider models remaining available after sign-out

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label May 26, 2026
@smitbarmase smitbarmase added the staff Pull requests authored by a current member of Zed staff label May 26, 2026
Comment thread crates/client/src/client.rs Outdated
llm_token: &LlmApiToken,
organization_id: Option<OrganizationId>,
) -> Result<String> {
self.ensure_authenticated_for_llm_token(llm_token).await?;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these checks if we instead proactively clear the LLM token on sign-out?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need this check. Otherwise, we would call LlmApiToken::cached which would try to fetch the token again (and likely succeed unless the token is expired)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess what I mean is that the flow for sign-out is:

  1. We call the sign-out method here:
    pub async fn sign_out(self: &Arc<Self>, cx: &AsyncApp) {
  2. This calls cloud_client.clear_credentials to clear the client access token
  • We can now longer get a new LLM token at this point, as the credentials have been cleared
  1. We call self.disconnect, which sets the status to Status::SignedOut

So if we react to the Status change and clear out the existing LlmApiToken, then there should be no other way to get a new one short of signing back in.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks. Removed the checks..

osyvokon added 2 commits May 27, 2026 01:56
Without an explicit auth check, the test becomes too complex
@osyvokon
osyvokon added this pull request to the merge queue Jun 3, 2026
Merged via the queue into main with commit 85d235b Jun 3, 2026
32 checks passed
@osyvokon
osyvokon deleted the clear-llm-token branch June 3, 2026 12:48
TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 8, 2026
Closes #FR-20

Release Notes:

- Fixed Zed provider models remaining available after sign-out
This was referenced Jun 18, 2026
liusuren123 pushed a commit to liusuren123/zed that referenced this pull request Jun 24, 2026
Closes #FR-20

Release Notes:

- Fixed Zed provider models remaining available after sign-out
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
Closes #FR-20

Release Notes:

- Fixed Zed provider models remaining available after sign-out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants