CLI Login Prompt has weird interactions with VSCode extension
What happened?
Problem Description
This issue arises when:
- A project is configured to use Jetify Secrets
- The user is not logged in
- The user attempts to use the
Reopen in Devbox Shellfeature in our VSCode Extension
The Reopen in Devbox Shell feature will attempt to start a shell in the background in order to reopen VSCode in the correct environment. However, since the current flow forces users to login if they have Devbox Secrets configured, and our extension does not provide a prompt for this login, the extension hangs indefinitely. We do open a browser window to login, but the user does not receive a prompt for why the browser window was opened.
Closing or cancelling the Reopen step does not terminate the background devbox process, and the running process will bind the address required to login. This means developers cannot login until they pkill the running process, or until they complete the login steps for the background devbox process
❯ devbox install
Info: Ensuring packages are installed.
Warning: Outputs for nixpkgs#darwin.apple_sdk.frameworks.SystemConfiguration are not in lockfile. Fetching store paths from nix, this may take a while
✓ Computed the Devbox environment.
You are not logged in.
Press Enter to open your browser and login...
Error: listen tcp 127.0.0.1:4446: bind: address already in use
Since it's not clear to the user why the Reopen in Devbox failed (no error message, no warning, no prompt), the user is unlikely to know how to resolve this issue.
Proposed Solution
We should never block devbox shell or other commands just because the user is logged out. A user may have valid reasons for logging out of Jetify Secrets -- e.g., they want to use a local .env file instead, or they may want to make the project available to users who don't have access to their secrets.
Instead, we should display a warning that the project is configured for Devbox Secrets, and that the user should login to use Secrets. This warning should be non blocking.
Steps to reproduce
Repro steps require VSCode with the Devbox Extension installed
- Login with
devbox auth login - Configure a project to use secrets with
devbox secrets init - Logout with
devbox auth logout - Open the project in VSCode, attempt to
Reopen the Project in Devbox Shell. Note that a browser window will open without any prompt or explanation. - Reopen step will hang with no messaging or information from the extension
- Cancel the extension by clicking the Cancel button in the notification
- Attempt to login with
devbox auth login. You will get abind error, the browser will relaunch, but signing in to the browser will not log you in (since it's pointing to the running session of Devbox).
Command
install, run, services, shell
devbox.json
{
"packages": [
"[email protected]"
],
"shell": {
"init_hook": [
"echo 'Welcome to devbox!' > /dev/null"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
},
"env_from": "jetpack-cloud"
}
Devbox version
0.11.0
Nix version
No response
What system does this bug occur on?
macOS (Apple Silicon)
Debug logs
No response