DEV Community

Cover image for Why Switching an AI Coding Account Is Harder Than Changing a Dropdown
Bargan Constantin
Bargan Constantin

Posted on Edited on AI-assisted

Why Switching an AI Coding Account Is Harder Than Changing a Dropdown

You switch your default coding account from personal to work. One terminal already has an agent running. Another is about to start. Which account will each use?

The answer depends on where the CLI gets its credentials and when it resolves them. An account picker changes a preference. Whether a live process follows that preference is a separate question.

Separate three kinds of state

State What it tells you
Default account Which identity a new launch is intended to use.
Process credentials Which identity the CLI actually uses for requests.
Session history Which conversation is displayed or resumed.

Consider a laptop and a development host reached over SSH. You change the default on the laptop while the host still has a session open. The laptop's picker alone tells you nothing about what that remote process will use on its next request. Verify the effective account from the CLI or a provider-supported identity check, separately for the existing process and a fresh launch.

An expired login and an exhausted quota need different recovery

Diagram of account selection and credential recovery across devices

A CLI can still be signed in when it has no remaining quota. A credential can also become invalid while a dashboard still shows the last quota reading. If the reading is stale, show when it was taken. If authorization fails, lead the user through the provider's sign-in flow rather than inferring the credential state from the usage bar.

Separate devices can also take different authentication paths. With independent sign-ins, each device can recover through its own provider flow. If a supported setup shares credentials, test renewal and revocation explicitly, and keep credential values out of logs, screenshots and bug reports.

A small test matrix before shipping a switcher

Use test accounts you are authorized to access and record the CLI version and OS.

  1. Start a session with account A. Switch the default to B and launch a second session. Verify both effective identities.
  2. Repeat with an explicitly selected account on the new launch. Record whether that selection overrides the default.
  3. Resume the first conversation and verify the identity separately from the conversation ID.
  4. Test an expired sign-in and an unavailable usage reading. Confirm each gives the user a useful next action.
  5. Repeat on the SSH host and check that the UI identifies which machine and process each result belongs to.

The product question I would use in review is simple: when someone clicks Switch account, can they tell exactly which session will use the new identity, and when?

Top comments (0)