sourcegraph / jetbrains

Apache License 2.0
61 stars 19 forks source link

JetBrains: Chat history from another account keep showing when user switch to different account. #2173

Open jay-fibi opened 2 weeks ago

jay-fibi commented 2 weeks ago

IDE Information

PyCharm 2023.3.3 (Community Edition) Build #PC-233.13763.11, built on January 26, 2024 Runtime version: 17.0.9+7-b1087.11 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 14.3 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 8 Metal Rendering is ON Non-Bundled Plugins: com.sourcegraph.jetbrains (6.0.38-nightly)

Bug Description

Platform: macOS

Steps to reproduce:

  1. Have Cody plugin installed in your JB PyCharm editor
  2. Login to Cody with Free/Pro user
  3. Check the Chat history
  4. Switch to another account
  5. Check the Chat history

Observed behavior:

Chat history from first account keep showing

Expected behavior:

Chat history for correct account should load

Additional context

Video link:

https://drive.google.com/file/d/1z1Lurp4LgGwa00ZpaWnR3m0AzDnq6G8d/view?usp=drive_link

mkondratek commented 2 weeks ago

The problem is that setActiveAccount calls ChatsController.disposeAllChats that calls ChatController.clearAndRestartSession that calls ChatController.saveSession that uses AuthProvider.getAuthStatus. the auth status is already new in the auth provider. we should rely on currentAuthAccount instead.

mkondratek commented 2 weeks ago

I spent some time on it today but no success. If anyone want's to pick it feel free. I will get back to it on Monday.

mkondratek commented 2 weeks ago

I am back on it 👀

jay-fibi commented 6 days ago

@mkondratek I am able to repro this issue with 7.0.3-nightly hence reopening.

mkondratek commented 2 days ago

https://linear.app/sourcegraph/issue/CODY-3754/chat-history-from-another-account-keep-showing-when-user-switch-to