Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix!: deprecate login_type=none, convert existing users to password login (#26851) - #27578

Merged
mtojek merged 2 commits into
release/2.36from
backport/26851-to-2.36
Jul 28, 2026
Merged

fix!: deprecate login_type=none, convert existing users to password login (#26851)#27578
mtojek merged 2 commits into
release/2.36from
backport/26851-to-2.36

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

⚠️ Renumbered the migration from 000554 to 000555: release/2.36 already has 000554_aibridge_token_usage_spend_export_index, so the cherry-picked 000554_legacy_none_login_to_password collided. Moved it to the next free slot (000555) and updated migrate_test.go accordingly.

Cherry-pick of #26851

Original PR: #26851 - fix!: deprecate login_type=none, convert existing users to password login
Merge commit: 0e104f3
Requested by: @jakehwll

… login (#26851)

> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

Deprecates `login_type=none` (legacy passwordless machine users) in
favour of premium **service accounts**, and migrates existing accounts
off the deprecated path while preserving their identity. Resolves
[DEVEX-226].

## What this does

- **Creation is gated** — `POST /users` and `coder users create` reject
`login_type=none` (and the deprecated `--disable-login`) unless a
service account is requested.
- **Existing users are converted** — migration
`000554_legacy_none_login_to_password` rewrites legacy non-system,
non–service-account `login_type='none'` accounts to
`login_type='password'`. Email addresses are **preserved** and existing
API tokens remain valid. Admins can set a password if interactive login
is desired.

## Why convert to `password` and not `is_service_account`?

Migration `000433_add_is_service_account_to_users` adds two CHECK
constraints:

- `users_email_not_empty`: `(is_service_account = true) = (email = '')`
- `users_service_account_login_type`: `is_service_account = false OR
login_type = 'none'`

Turning a real, email-bearing `login_type=none` user into a service
account would require **blanking their email**. Converting to `password`
instead preserves the account and its email.

> ⚠️ **Breaking / one-way.** The `down` migration cannot restore which
users originally had `login_type='none'`.

Decision log

- **Goal:** move existing `login_type=none` users off the deprecated
path while preserving their identity/email.
- **Constraint discovered:** the `is_service_account` CHECK constraints
(migration `000433`) make a literal `none → service account` conversion
require blanking emails, so this PR converts to `password` instead to
keep emails intact.
- **Implementation:** creation-gating in `cli/usercreate.go` and
`coderd/users.go`, matching test updates, plus the
`000554_legacy_none_login_to_password.{up,down}.sql` migration.
- **CI fix:** the branch was behind `main` and its migration originally
numbered `000534`, which collided with main's
`000534_drop_chat_model_configs_provider`. Merged `main` and renumbered
to `000554` (next free after main's `000553`). `make gen` produces no
drift (the migration is data-only).

> The service-account conversion alternative (#27182, which blanked
emails) was closed in favour of this password-preserving approach.
>
> Docs follow-up: #27333.

[DEVEX-226]: https://linear.app/issue/DEVEX-226

---------

Co-authored-by: Sushant P <[email protected]>
(cherry picked from commit 0e104f3)
@github-actions github-actions Bot added the cherry-pick/v2.36 Cherry-pick PR targeting release/2.36 label Jul 28, 2026
@github-actions
github-actions Bot requested a review from jakehwll July 28, 2026 11:11
@coderagents

coderagents Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

This is a backport of #26851 (which shipped no docs changes). login_type=none moves from "deprecated" to rejected: POST /api/v2/users returns 400 Login type 'none' requires a service account., and coder users create --login-type none / --disable-login now error out. Migration 000555 (renumbered from 000554 in 82f17f6) also converts existing non-service-account, non-system login_type=none users to password. Docs still describe this only as deprecated.

Updates Needed

  • docs/tutorials/testing-templates.md - The warning under "Creating the headless user" says --login-type none is "deprecated". It is now rejected with an error, so the wording should state that it is no longer accepted and point to --service-account (Premium) or password/GitHub/OIDC users (OSS).

    ⚠️ Still open: no documentation changes in this PR as of 82f17f6

  • docs/admin/users/headless-auth.md - Add upgrade guidance for existing login_type=none accounts: on upgrade they are converted to password login, existing API tokens keep working, and no password is set until an admin sets one (so password login is unusable until then). Service accounts and system users are unaffected.

    ⚠️ Still open: no documentation changes in this PR as of 82f17f6

Notes

  • docs/reference/cli/users_create.md and docs/reference/api/* are auto-generated from the cli/ and codersdk changes in this PR; no manual edits needed, but confirm make gen output is in sync on the branch this lands from.
  • docs/install/releases/esr-2.29-2.34-upgrade.md describes the 2.34 state accurately and needs no change; if a 2.36 upgrade/ESR guide exists or is planned, this breaking change and the data migration belong there.
  • Docs fixes should land on main rather than in this backport branch.

Automated review via Coder Agents

@mtojek
mtojek self-requested a review July 28, 2026 11:14

@mtojek mtojek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sqlc / lint / gen are failing.

@jakehwll could you take a look?

@github-actions

Copy link
Copy Markdown
Contributor Author

👋 Hey @github-actions[bot]!

This PR is targeting the release/2.36 release branch, but its title does not start with fix: or fix(scope):.

Only bug fixes should be cherry-picked to release branches. If this is a bug fix, please update the PR title to match the conventional commit format:

fix: description of the bug fix
fix(scope): description of the bug fix

If this is not a bug fix, it likely should not target a release branch.

@jakehwll
jakehwll requested a review from mtojek July 28, 2026 11:23
jakehwll added a commit that referenced this pull request Jul 28, 2026
…ollision (#27581)

> 🤖 This PR was written by Coder Agents on behalf of Jake Howell.

## Problem

`main` currently has **two migrations sharing version `000554`**:

- `000554_aibridge_token_usage_spend_export_index.{up,down}.sql`
- `000554_legacy_none_login_to_password.{up,down}.sql` (from #26851)

Both merged around the same time. #26851 was renumbered to `000554` when
`000553` was the latest, but `aibridge_token_usage_spend_export_index`
claimed `000554` and merged too, leaving a duplicate version number on
`main`. Duplicate migration versions break the migration sequence.

## Fix

Renumber the legacy none login migration to the next free slot,
`000555`, leaving the aibridge migration at `000554`:

- `000554_legacy_none_login_to_password.{up,down}.sql` ->
`000555_legacy_none_login_to_password.{up,down}.sql`
- `migrate_test.go`: `TestMigration000554...` ->
`TestMigration000555...`, `priorMigrationVersion` `553` -> `554`, and
the `os.ReadFile` filename.

The migration is data-only and unchanged; only its version number moves.
`TestMigration000555LegacyNoneLoginToPassword` passes locally.

The same collision exists on `release/2.36` via the backport (#27578),
which has been renumbered to `000555` to match.

Resolves [DEVEX-226] follow-up.

[DEVEX-226]: https://linear.app/issue/DEVEX-226
@mtojek
mtojek merged commit 1bf446c into release/2.36 Jul 28, 2026
32 of 33 checks passed
@mtojek
mtojek deleted the backport/26851-to-2.36 branch July 28, 2026 11:37
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cherry-pick/v2.36 Cherry-pick PR targeting release/2.36

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants