Skip to content

Commit c8afc2c

Browse files
committed
Prompt for workspace selection when discovery provides account_id
The post-OAuth workspace selection was gated on IsUnifiedHost, which is only set via --experimental-is-unified-host or from an existing profile. When a user passes --host pointing to a SPOG-enabled workspace, discovery fetches account_id from .well-known/databricks-config but never sets IsUnifiedHost, so workspace selection was silently skipped. Now the condition checks only for account_id + missing workspace_id, regardless of IsUnifiedHost. Also adds a message in non-interactive mode telling the user to set workspace_id. Co-authored-by: Isaac
1 parent 352aa7b commit c8afc2c

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

cmd/auth/login.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,11 @@ depends on the existing profiles you have set in your configuration file
247247
// 2. Configuring cluster and serverless;
248248
// 3. Saving the profile.
249249

250-
// For unified/SPOG hosts with account_id but no workspace_id, prompt for
251-
// workspace selection. We use IsUnifiedHost (set from discovery or profile)
252-
// rather than HostType(), which is unreliable for SPOG hosts. Classic
253-
// accounts.* hosts don't need this because they access account-level APIs
254-
// directly. Skip workspace selection if:
255-
// - --skip-workspace flag is set
256-
// - workspace_id is already set (including "none" sentinel from a previous login)
257-
shouldPromptWorkspace := authArguments.IsUnifiedHost &&
258-
authArguments.AccountID != "" &&
250+
// If discovery gave us an account_id but we still have no workspace_id,
251+
// prompt the user to select a workspace. This applies to any host where
252+
// .well-known/databricks-config returned an account_id, regardless of
253+
// whether IsUnifiedHost is set.
254+
shouldPromptWorkspace := authArguments.AccountID != "" &&
259255
authArguments.WorkspaceID == "" &&
260256
!skipWorkspace
261257

@@ -717,6 +713,7 @@ func oauthLoginClearKeys() []string {
717713
// to the user.
718714
func promptForWorkspaceSelection(ctx context.Context, authArguments *auth.AuthArguments, persistentAuth *u2m.PersistentAuth) (string, error) {
719715
if !cmdio.IsPromptSupported(ctx) {
716+
cmdio.LogString(ctx, "To use workspace commands, set workspace_id in your profile or pass --workspace-id.")
720717
return "", nil
721718
}
722719

0 commit comments

Comments
 (0)