Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cody: fix sign in issues with App #54106

Merged
merged 16 commits into from
Jun 26, 2023
Merged

cody: fix sign in issues with App #54106

merged 16 commits into from
Jun 26, 2023

Conversation

abeatrix
Copy link
Contributor

@abeatrix abeatrix commented Jun 24, 2023

Close #54045
Moved from #54063

This PR solves connection issues with App where:

  1. can’t log out and get back in without access token
  2. can't log in if you have VS Code open first, before installing app

App team has confirmed the changes in this PR fixed the issue: (slack thread 1, slack thread 2, slack thread 3)

Auth View Loading Issue - moving to a new PR

Notice we were setting authStatus on config change, which would first pick up the default config when the view is first loaded.

Update to send authStatus with config file via the publishConfig function, which gets trigger on every config change, and the login function also triggers it since the login function also updates the user config. this one we can make sure the config call would have the latest info.

Here you can see the call stack where login would be called before config change
image

update

i found that i broke the last PR by accidentally removed (!view), where vscodeAPI.postMessage({ command: 'initialized' }) gets called repeatedly 😭

        if (!view) {
            vscodeAPI.postMessage({ command: 'initialized' })
        }

Test plan

Here is a video of how the changes would look:

Code.-.Extension.Development.Host.Welcome.-.23.June.2023.mp4

@cla-bot cla-bot bot added the cla-signed label Jun 24, 2023
@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Jun 24, 2023

📖 Storybook live preview

@toolmantim
Copy link
Contributor

@abeatrix just pushed some fixes for the Storybook renders, and approved them on Chromatic ✅

Copy link
Contributor

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

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

There are still issues for me even after those changes. When i reload VS Code, I’m always logged out 😞

Screen.Recording.2023-06-26.at.11.37.28.mov

@philipp-spiess
Copy link
Contributor

Noticed something else on main (might be fixed on your PR but I want to write it down regardless):

When I reload VS Code, Cody always shows up on the sidebar, even if I had another sidebar view active before.

@toolmantim
Copy link
Contributor

toolmantim commented Jun 26, 2023

I'm experiencing a similar bug to @philipp-spiess, where the login page will flash still… but it's usually when you reload from the file explorer or other places. If you reload with Cody focused, I always see the nicer loading animation and chat view. Here is reloading the window from the file explorer, and reloading from Cody chat:

Screen.Recording.2023-06-26.at.11.18.59.pm.mov

I don't think I'm experiencing a full logout though, but it does seem to show the "Download Cody" button on reload if I log into another endpoint, requiring you to use "Switch Account":

Screen.Recording.2023-06-26.at.11.26.52.pm.mov

Repro steps:

  • Login to sourcegraph.com
  • Reload the window
  • See "Download Cody" button
  • Choose "Switch Account" and click on the "current" (which should be https://sourcegraph.com/)
  • See the logged in chat

@abeatrix
Copy link
Contributor Author

Hmm the logout issue is weird I don't think I've run into that before.
@philipp-spiess Can you check if you have a different Endpoint set in your workspace settings?
@toolmantim ill take a look at this thanks for testing!

@philipp-spiess
Copy link
Contributor

@abeatrix My user config has

  "cody.serverEndpoint": "https://sourcegraph.com/",

But I also picked the dotcom login in the dropdown list I think

@abeatrix
Copy link
Contributor Author

@toolmantim @philipp-spiess the app team has confirmed the changes in this PR solved the sign in issues with App (slack thread 1, slack thread 2, slack thread 3), so I'm going to merge this PR and open a new PR for the loading issue.

@abeatrix abeatrix changed the title cody: fix auth view loading issue cody: fix sign in issues with App Jun 26, 2023
@abeatrix
Copy link
Contributor Author

Here is the latest demo of the sign in flow using the last commit from this branch: https://www.loom.com/share/9a3be7ebff0248748522da1c3bc5b3df?sid=b755b69b-7ede-424d-b9d0-b966991a9b1f

@abeatrix abeatrix merged commit 15841e5 into main Jun 26, 2023
28 checks passed
@abeatrix abeatrix deleted the bee/cody-auth-view-load branch June 26, 2023 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cody: Sidebar shows login screen when still initializing
4 participants