Skip to content

Prevent Desktop owner lockout before adding accounts - #13961

Merged
danielhanchen merged 14 commits into
unslothai:mainfrom
mahiatlinux:fix/studio-desktop-auth-lockout
Nov 3, 2026
Merged

danielhanchen merged 14 commits into
unslothai:mainfrom
mahiatlinux:fix/studio-desktop-auth-lockout

Conversation

@mahiatlinux

@mahiatlinux mahiatlinux commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Desktop can create a managed account while its owner still has a generated password that the app never shows. This switches the installation to multi-account sign-in and can lock the owner out after the current session expires.

Creating an account now opens the existing password dialog when the owner password is still generated, then continues to the existing account-creation form. Cancelling creates no account. The server checks the same prerequisite inside the existing account-creation transaction, so older frontends cannot create the lockout state. Owners who already chose a password continue directly to account creation.

Shared installations retain strict multi-account Desktop login. The Desktop secret does not bypass it. Existing locked-out installations retain the unsloth studio reset-password recovery command. The change introduces no native protocol, installer, updater, persistent schema, notebook, GPU-detection or inference changes.

Validation:

  • The real SQLite/HTTP differential fails on merge base 2099086d8 and passes on reviewed head b06e347b2: account creation changes from 201 with a generated password to 400 with unchanged account records. After password setup, creation returns 201 and the chosen owner password signs in successfully. Desktop-secret exchange still requires login in multi-account mode.
  • Related local backend account, Desktop-network and policy suites: 202 passed. Related frontend settings, account API, Desktop auth, refresh and transition suites: 121 passed.
  • Fresh scoped staging is green on Ubuntu, Windows and Apple Silicon macOS 26: 154 backend tests, strict locale parity and 18 frontend tests on each OS. Integration 1250a66ef; runs 41454175696, 41454175721 and 41454175728.
  • Chromium, Firefox, WebKit and Edge pass all eight base/head onboarding cells. Cancellation/retry and repeated unavailable-status checks keep creation closed without creating an account.
  • The complete Studio comparison is NO_REGRESSION: 46 SAME steps and one DOM-only inventory difference with zero changed pixels. It exercises 128/144 controls, plus 12 denied controls (97.0% safe coverage). Isolated-tool and upstream UI units run on Colab T4-HM; no local GPU is used.
  • All 25 locales include the new explanation. Strict locale parity, full frontend type checking, production build, formatting, lint and the pre-push gate pass.

The complete local frontend suite reports 14,670 passed, one skipped and one pre-existing font-spacing failure, reproduced on the original merge base with the affected component and test unchanged. Broader inherited CI also exposes an unrelated composer font-scale contract and companion Zoo CPU-MLX cache-shim failures; their baseline reproductions are recorded. The source organization queue cancelled its remaining jobs, so those jobs are not counted as passes; current scoped staging is green.

Native Linux checks have passed all routes and Settings in one corrected-head run. Complete current native validation remains unproven: a bounded replacement run receives RemoteDisconnected on both base and head at different WebDriver steps, and the unchanged red report is retained. No product change was made for that transport fault. Native macOS/Windows GUI, WSL and previous-release updater execution are not claimed. The browser onboarding evidence uses real frontends and backends with an adapter for native IPC.

Before and after: adding an account from Desktop

Base 2099086d8 opens account creation immediately while the owner password is still generated. Reviewed head b06e347b2 opens Set password first and then continues account creation. Source head 3cb8ac3a9 adds only an empty CI-release commit. Both sides keep strict multi-account Desktop login.

Before: account creation. After: owner password setup before account creation.

A desktop owner is seeded with a bootstrap password it never sees, and
nothing asks for a real one before the first managed account is created.
Once that account exists and the webview holds no session, desktop-login
answered login_required and the owner faced a form no credential could
complete. Keep minting owner tokens in multi mode until the owner has set
a password; the refusal still applies after that.
Desktop tokens used to mean a one-account install, so the webview set the
login mode to single without asking. Now the owner also receives tokens on
a multi-account install while the bootstrap password stands, and that
hardcoded mode showed the single-account remote password copy there.
Fetch the status instead; it still clears a stale multi hint once the
last managed account is gone.
@mahiatlinux

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-02T10:55:46.725080Z
We couldn’t complete this review. Comment @codex review to try again.
ab6e3d4 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e4f42082c7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread studio/backend/routes/auth.py Resolved
…owner tokens

The secret answers for the shell, not for whoever signed in to the
document. With owner tokens now minted on a multi-account install while
the bootstrap password stands, the token path would have replaced a
managed account's live desktop session with the owner's on the next
launch. Refresh and keep a managed session that is still valid, as the
login_required path already does, and fall back to the owner tokens only
when it no longer refreshes.
@mahiatlinux

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: fd766802b0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@mahiatlinux

Copy link
Copy Markdown
Contributor Author

@codex security review

1 similar comment
@mahiatlinux

Copy link
Copy Markdown
Contributor Author

@codex security review

danielhanchen added a commit that referenced this pull request Oct 16, 2026
…13983)

## Summary

`Frontend build + bundle sanity` fails on PRs based on current main (for
example #13961 and #13963) with `over the startup budget`. Main itself
is over:

| commit | raw | transfer |
|---|---|---|
| 5870795 | 6,791,021 B (within) | 2,042,102 B (within) |
| 4a8b727 (main) | 6,791,768 B (587 B over) | 2,042,404 B (113 B
over) |

All numbers are from one machine and build, Node 24, with the chunk
count unchanged at 95.

Measured commit by commit, no single import did it:
- Deep research under Tools in the + menu (#13959) took main over, at
+0.2 KB raw.
- The connection name and provider menu order (#13964) and the
attachment card polish (#13970) add the rest, 0.1 and 0.4 KB raw.

All of it lands in the eager chat and settings chunks.

## Change

Following the file's own rule ("raise BUDGET in this file ... with the
measured numbers"), the budget is raised by that growth, 747 B raw and
302 B transfer, so main keeps the margin it had at 5870795. The
measurement is recorded next to the limits like the previous raises.

## Testing

- `npm run build && npm run bundle:check` on main with this change:
within budget (0.2 KB transfer, 0.2 KB raw to spare). Without it: over
by the amounts above.
- `tests/bundle-budget-cli.test.ts` and
`tests/bundle-budget-closure.test.ts`: 43 passed.
- `prettier --check scripts/check-bundle-budget.ts`: clean.
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 28, 2026
…ts, and let the owner sign in with a chosen name (unslothai#15619)

Settings > Accounts showed the owner as "unsloth" with a letter avatar,
even when the owner had set a profile name and picture. The owner also
always had to sign in as `unsloth` (and `reset-password --username
<profile name>` said "account not found"), and Unsloth Desktop had no
Log out at all.

- **Accounts:** each row shows the profile name and avatar, plus the
name it signs in with. The owner's row has a "..." menu with Change
password; so does the Profile page.
- **Owner sign-in name:** set in Settings > Accounts, checked like a
managed username and can't clash with one. Login and `reset-password
--username` accept it; `unsloth` keeps working and stays the internal
identity. New nullable `auth_user.login_alias` column.
- **Log out on Desktop:** shown in the user menu and the shortcut. It
writes a marker next to the desktop secret so the shell can't sign the
owner straight back in, even after a quick quit. Single account: the
login page offers "Continue as owner". Multi account: username and
password.

Password changes only happen in Settings while signed in; nothing new on
the login screen.

**Tested** on Unsloth Desktop built from this branch (Change password,
sign-in name and multi-account shots taken at `3feaf61`), Windows 11
(AMD R9700), isolated install. Log out, quit 2 s later and relaunch
stays signed out; Continue as owner survives a relaunch; signing in with
the sign-in name works in Desktop, in Edge, and in `reset-password`.
Backend, Rust (`desktop_auth`) and frontend suites pass on a MacBook Pro
M5. Not tested by hand: Linux and macOS Desktop.

| Before (main) | After |
|---|---|
| <img
src="https://raw.githubusercontent.com/LeoBorcherding/unsloth/b8df1b1b56856ead2773361394c504a8eda3215f/01-before-main-accounts.png"
width="420"> | <img
src="https://raw.githubusercontent.com/LeoBorcherding/unsloth/b8df1b1b56856ead2773361394c504a8eda3215f/02-accounts-owner-profile.png"
width="420"> |
| Log out in the Desktop user menu<br><img
src="https://raw.githubusercontent.com/LeoBorcherding/unsloth/b8df1b1b56856ead2773361394c504a8eda3215f/03-desktop-log-out.png"
width="420"> | Signed out, single account<br><img
src="https://raw.githubusercontent.com/LeoBorcherding/unsloth/b8df1b1b56856ead2773361394c504a8eda3215f/04-desktop-signed-out.png"
width="420"> |
| Change password, from the owner's "..." menu<br><img
src="https://raw.githubusercontent.com/LeoBorcherding/unsloth/b8df1b1b56856ead2773361394c504a8eda3215f/05-change-password.png"
width="420"> | Signed out, multi account (owner can use the sign-in
name)<br><img
src="https://raw.githubusercontent.com/LeoBorcherding/unsloth/b8df1b1b56856ead2773361394c504a8eda3215f/06-desktop-signed-out-multi.png"
width="420"> |

Related: unslothai#13961 (independent).



### Before / after: Settings > Accounts

Same owner profile (display name "Riley Owner" and avatar) and one
managed account on both sides; merge base `a20b732e0` vs head
`46cb010ed`. The owner row now shows the profile name and avatar, every
row shows the name it signs in with, the owner gets a "..." menu with
Change password, and the owner sign-in name field appears.

<img
src="https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/15619/pr15619_before_after-a38549a59158.png"
width="900">

---------

Co-authored-by: Daniel Han <[email protected]>
@danielhanchen danielhanchen self-assigned this Nov 2, 2026
danielhanchen added a commit to Imagineer99/unsloth that referenced this pull request Nov 2, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 2, 2026
@shimmyshimmer

shimmyshimmer commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Review record for #13961, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#701.

Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found.

Round 1: reviewed mirror 8c59f8fc6 (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] (on the mirror)

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 8c59f8fc6b

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror 8c59f8fc6 (no equivalent commit found on this PR).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

danielhanchen added a commit to Etherll/unsloth that referenced this pull request Nov 2, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 2, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 2, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 2, 2026
@shimmyshimmer shimmyshimmer changed the title studio: set owner password before adding managed accounts Prevent Desktop owner lockout before adding accounts Nov 2, 2026
@danielhanchen
danielhanchen merged commit 304e6ce into unslothai:main Nov 3, 2026
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.

4 participants