You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#2181Fixes#2154
This PR attempts to clean up the auth flow and makes it so that when the
user account is switched, we never accidentely use feature flags of a
wrong server URL and also ensures we reconfigure Autocomplete so it
works.
It does this by removing the relationship between the `AuthProvider` and
a specific webview. This is necessary because:
- With features like Autocomplete, we have things that depend on the
AuthProvider unrelated on wether a web view is enabled or not
- We have more than one web view right now and this doesn't make sense
Instead, we make it so that the web views subscribe to the auth state
like every other service.
In untangling this, the biggest issue was undocumented dependencies into
how events were passed. What I noticed was that the `ContextProvider`
plays a major role in initializing the web views. This is something we
should clean up in a follow up PR (IMO the web views should subscribe to
the ContextProvider and not the other way around).
I also noticed that the `cody.auth.sync` action isn't really necessary
as we can subscribe to the `AuthProvider` via `addChangeListener`
anyways (which most of the services did).
Also: Apparently there were two ways on when we reconfigure the
`Configuration` object. I now made sure both ways at least reconfigure
the same components by extracting a `onConfigurationChange` function
inside `main.ts`.
Two unrelated fixes:
- The code to update the upgrade state when the editor was focused would
also run on enterprise instances causing a bunch of errors in the
console. Fixed.
- Added the remote URL to the completion loggers we can easily see where
the request is sent to.
⚠️ This PR has a potential to break areas depending on auth, so please
take some time to test it. I've been testing it as thorough as I could
though!
## Test plan
The canonical test case was:
- Be signed in to dotcom and have the starcoder-hybrid feature flag
enable
- Now switch account to an enterprise instance
- Ensure that requests are made to the enterprise instance and that we
do not use starcoder model strings
https://github.com/sourcegraph/cody/assets/458591/ab5a19a6-a906-42e6-8f76-ae61b500e30c
<!-- Required. See
https://docs.sourcegraph.com/dev/background-information/testing_principles.
-->
This can lead to weird situations:
The text was updated successfully, but these errors were encountered: