Skip to content

Make browser login the default, and make modelslab update work on Windows and under package managers - #10

Merged
adhikjoshi merged 1 commit into
mainfrom
fix/login-default-browser
Sep 18, 2026
Merged

adhikjoshi merged 1 commit into
mainfrom
fix/login-default-browser

Conversation

@adhikjoshi

@adhikjoshi adhikjoshi commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

A customer on Windows (pip, in a venv) ran modelslab auth login and got:

Email: serialkiller@gmail.com
Password:
Error: password: no input provided

Their account came from Continue with Google (signup_source = google), so it has no password. The prompt asked for something that does not exist, and the error never said so. The npm and PyPI READMEs send every new user to exactly that bare modelslab auth login.

Login

  • Browser OAuth is the default in an interactive terminal. Email and password are still used with --email, --password or --browser=false, when stdin is not a terminal (scripts piping credentials), and when there is no local browser: over SSH, or Linux with no display. The callback listens on 127.0.0.1, which a browser across SSH cannot reach.
  • An empty password now says no password entered and points at auth login --browser and auth forgot-password.

Update

Both the notification and modelslab update already existed. They had these problems:

Problem Fix
modelslab update always failed on Windows ("Windows cannot replace a running executable") Windows renames a running .exe; move it to .old, put the new one in place, delete .old on the next run
Under pip / pipx / uv / npm / Homebrew / Scoop it overwrote a file the package manager owns Detect the install method from the binary path; print that manager's command instead
The notification told everyone to run modelslab update Show the command for the install method, e.g. pip install --upgrade modelslab-cli
A failed check was not cached, so offline every command waited 1.5 s Cache failures; keep what the last good check found
Notification printed in CI and into captured stderr Skip when CI is set or stderr is not a terminal
Bare "permission denied" on /usr/local/bin or Program Files Say to use sudo or an Administrator terminal

Verification

  • go vet ./... and go test ./internal/... pass; 14 new tests (login mode, install-method detection, failed-check caching, replace, permission hint). Cross-builds for windows/amd64, windows/arm64, linux/amd64, darwin/amd64.
  • Real binary, driven through a pty:
    • bare auth login → browser flow; over SSH / --browser=false / --email → password prompt; Enter at the prompt → the new hint.
  • Real binary built as 0.1.4, against the live GitHub release:
    • notification shows modelslab update for a standalone copy and pip install --upgrade modelslab-cli for a copy under site-packages/modelslab_cli/bin/; silent with CI=1 and with redirected stderr;
    • modelslab update in the pip layout refuses with the pip command, exit 1;
    • the standalone copy self-updated 0.1.4 → 0.2.0, checksum verified, no .old/.new left.
  • Not verified: the Windows rename path on a real Windows machine (cross-compiled only).

Note for the release

Users on 0.2.0 run the old updater until they upgrade, and its notice says modelslab update, which fails on Windows. Release notes and support replies should tell pip users to run pip install --upgrade modelslab-cli.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NJxK2YGapyVchfyE1F8CpR


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…indows and under package managers

A customer on Windows (pip, in a venv) ran `modelslab auth login` and got
"Error: password: no input provided". Their account came from "Continue with
Google", so it has no password: the prompt asked for something that does not
exist, and the error never said so. The npm and PyPI READMEs send every new
user to exactly that bare `modelslab auth login`.

Login
- Browser OAuth is now the default in an interactive terminal. Email and
  password are still used with --email, --password or --browser=false, when
  stdin is not a terminal (scripts piping credentials), and when there is no
  local browser to finish the grant: over SSH, or on Linux with no display. The
  callback listens on 127.0.0.1, which a browser across SSH cannot reach.
- An empty password now says "no password entered" and points Google and
  GitHub accounts at `auth login --browser` and `auth forgot-password`.

Update
- Windows: `modelslab update` always failed with "Windows cannot replace a
  running executable". Windows will rename a running .exe even though it will
  not delete one, so the old binary moves aside to .old, the new one takes its
  name, and the .old file is removed on the next run.
- Package managers: under pip, pipx, uv, npm, Homebrew or Scoop the updater
  overwrote a file the package manager owns — pip kept reporting the old
  version, the next `brew upgrade` or `npm install` put the old file back, and
  on Windows the launchers hold the file open. The install method is now read
  from the binary's path; `modelslab update` prints that manager's command
  instead, and `update --check` reports it.
- The notification said "Run `modelslab update`" to everyone. It now shows the
  command for the install method, e.g. `pip install --upgrade modelslab-cli`.
- A failed check was never cached, so offline, behind a proxy, or after
  GitHub's anonymous rate limit, every command waited out the 1.5s timeout.
  Failures are cached now and keep what the last good check found.
- No notification in CI or when stderr is not a terminal.
- "permission denied" on /usr/local/bin or Program Files now says to use sudo
  or an Administrator terminal.

Verified against the real GitHub release with a 0.1.4 build: the notification
shows the right command for a standalone and a pip layout and stays silent with
CI=1 or redirected stderr; `update` in the pip layout refuses with the pip
command; the standalone binary self-updated to 0.2.0 with its checksum
verified and no .old/.new left behind. The Windows rename path is covered by
cross-compilation only and still needs a run on a real Windows machine.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJxK2YGapyVchfyE1F8CpR
@adhikjoshi
adhikjoshi merged commit a90ba17 into main Sep 18, 2026
8 checks passed
@adhikjoshi
adhikjoshi deleted the fix/login-default-browser branch September 18, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant