Skip to content

auth login: cap the optional workspace lookup at 5s and explain the fallback - #7522

Merged
qianhao-zhang-databricks merged 3 commits into
mainfrom
qianhao/auth-login-workspace-list-timeout
Nov 13, 2026
Merged

qianhao-zhang-databricks merged 3 commits into
mainfrom
qianhao/auth-login-workspace-list-timeout

Conversation

@qianhao-zhang-databricks

Copy link
Copy Markdown
Contributor

Changes

databricks auth login on a unified host now gives up on the optional workspace lookup after ~5 seconds instead of ~5 minutes, prints a progress line while it looks, and says why it fell back to the manual prompt.

  • The account client used for Workspaces.List gets HTTPTimeoutSeconds and RetryTimeoutSeconds of 5. Other API calls keep the SDK default retry policy.
  • Prints Looking up workspaces for your account... before the lookup.
  • On failure, prints that the workspaces could not be listed and shows the non-interactive form --host "<host>?w=<workspace_id>", then shows the existing Enter workspace ID prompt.

Why

After OAuth succeeds, the CLI lists account workspaces to populate a picker. When that endpoint returns 503 the SDK retried for its default ~5 minutes with no output, which looks like a hang to people and to coding agents with tool timeouts. The lookup is best-effort and already falls back to a manual prompt, so retrying that long only adds dead time. Ticket: CNXT-2597.

Tests

  • Added TestPromptForWorkspaceSelectionGivesUpQuicklyOnUnavailable: a server that always returns 503 must lead to the manual workspace ID prompt, the progress line and the ?w= hint, well under the old 5 minute budget. The test shortens the 5s budget to 1s through a test-only setter.
  • Regenerated one golden file, TestPromptForWorkspaceSelectionNoResults/01-initial.golden, which now includes the progress line.
  • go test ./cmd/auth/ passes. I did not run the new test without the fix to confirm it fails first.

This pull request and its description were written by Isaac.

…allback

On a unified host, `databricks auth login` lists account workspaces to
populate a picker. When that call returned 503 the SDK retried for its
default ~5 minutes with no output before falling back to the manual
workspace ID prompt. The lookup is best-effort, so bound its retry and HTTP
budget to 5 seconds, print a progress line, and show why it fell back along
with the non-interactive `--host "<host>?w=<workspace_id>"` form.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: e55d5d9

Run: 43122878454

Env 🔄​flaky 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 270 15 7:26
💚​ aws-windows-latest-4core-16gb 1 272 13 5:18
🔄​ azure linux-2core-8gb 2 1 267 15 8:41
💚​ azure-windows-latest-4core-16gb 1 271 13 5:03
💚​ gcp linux-2core-8gb 1 270 15 7:08
💚​ gcp-windows-latest-4core-16gb 1 272 13 4:53
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🔄​ TestFsCpDirToDirFileNotOverwritten ✅​p ✅​p 🔄​f ✅​p ✅​p ✅​p
🔄​ TestFsCpDirToDirFileNotOverwritten/dbfs_to_uc-volumes ✅​p ✅​p 🔄​f ✅​p ✅​p ✅​p
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:26 gcp linux-2core-8gb TestAccept
4:06 aws linux-2core-8gb TestAccept
3:59 aws-windows-latest-4core-16gb TestAccept
3:54 azure-windows-latest-4core-16gb TestAccept
3:52 azure linux-2core-8gb TestAccept
3:49 gcp-windows-latest-4core-16gb TestAccept

@rugpanov
rugpanov removed their request for review November 12, 2026 09:40

@mihaimitrea-db mihaimitrea-db left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Change looks good.

Comment thread cmd/auth/login.go
workspaces, err := a.Workspaces.List(ctx)
if err != nil {
log.Debugf(ctx, "Failed to load workspaces (this can happen if the user has no account-level access): %v", err)
cmdio.LogString(ctx, "Could not list workspaces for this account. To skip this step, pass a host with the workspace ID, e.g. --host \"<host>?w=<workspace_id>\".")

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.

nit: The non-TTY branch a few lines up tells users to pass --workspace-id, and this hint suggests --host "<host>?w=<workspace_id>" for the same goal. Both work, but it'd be nice if the two messages agreed. --workspace-id is also shorter and doesn't make the user rebuild the host URL. People who only want account-level access probably want --skip-workspace instead, so it could be worth mentioning too. Something like:

cmdio.LogString(ctx, "Could not list workspaces for this account. To skip this step, pass --workspace-id <workspace_id>, or --skip-workspace for account-level access only.")

@qianhao-zhang-databricks
qianhao-zhang-databricks added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit daad5b4 Nov 13, 2026
28 checks passed
@qianhao-zhang-databricks
qianhao-zhang-databricks deleted the qianhao/auth-login-workspace-list-timeout branch November 13, 2026 18:04
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

❌ Integration test report

Commit: daad5b4

Run: 43479187580

Env ❌​FAIL 🟨​KNOWN 💚​RECOVERED ✅​pass 🙈​skip Time
❌​ aws linux-2core-8gb 25 1 11 1601 1313 267:41
❌​ aws-windows-latest-4core-16gb 29 1 11 1516 1340 297:13
💚​ azure linux-2core-8gb 12 1606 1321 208:01
💚​ azure-windows-latest-4core-16gb 12 1525 1348 213:57
💚​ gcp linux-2core-8gb 12 1613 1319 221:21
💚​ gcp-windows-latest-4core-16gb 12 1532 1346 233:26
58 interesting tests: 46 FAIL, 11 RECOVERED, 1 KNOWN
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
🟨​ TestAccept 🟨​K 🟨​K 💚​R 💚​R 💚​R 💚​R
❌​ TestAccept/bundle/apps/compute_size ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/apps/compute_size/DMS=true ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/invariant/delete_idempotent ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=cluster.yml.tmpl/READPLAN=1 ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/invariant/destroy_idempotent ❌​F ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster.yml.tmpl/READPLAN= ❌​F ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster.yml.tmpl/READPLAN=1 ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN= ❌​F ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster_libraries.yml.tmpl/READPLAN= ❌​F ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster_libraries.yml.tmpl/READPLAN=1 ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/invariant/no_drift ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=cluster.yml.tmpl/READPLAN=1 ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN= ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN=1 ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=cluster_libraries.yml.tmpl/READPLAN=1 ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
💚​ TestAccept/bundle/resources/apps/lifecycle-started 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started-omitted 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=true 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started-toggle 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS= 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=true 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started/DMS= 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/apps/lifecycle-started/DMS=true 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
❌​ TestAccept/bundle/resources/clusters/lifecycle-started-toggle ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS= ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/dashboards/generate_inplace ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/dashboards/generate_inplace/DMS=true ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/genie_spaces/simple ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/genie_spaces/simple/DMS=true ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/grants/catalogs ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/grants/catalogs/DMS= ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/grants/schemas/duplicate_principals ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/grants/schemas/duplicate_principals/DMS= ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/grants/volumes ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/grants/volumes/DMS=true ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/job_runs/wait ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/job_runs/wait/DMS=true ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/materialization_sets/immutable ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/materialization_sets/immutable/DMS= ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/model_provider_services/lifecycle ❌​F ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/model_provider_services/lifecycle/DMS= ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/model_provider_services/lifecycle/DMS=true ❌​F ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/model_services/lifecycle ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/model_services/lifecycle/DMS= ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/model_serving_endpoints/basic ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/model_serving_endpoints/basic/DMS=true ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
💚​ TestAccept/bundle/resources/postgres_synced_tables/recreate 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/postgres_synced_tables/recreate/DMS= 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/postgres_synced_tables/recreate/DMS=true 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
❌​ TestAccept/bundle/resources/registered_models/comment_cleared ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestAccept/bundle/resources/registered_models/comment_cleared/DMS=true ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestSyncIncrementalSyncPythonNotebookToFile ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestImportDir ✅​p ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestFilerReadDir ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestFilerReadDir/workspace_files ❌​F ✅​p ✅​p ✅​p ✅​p ✅​p
❌​ TestFilerRecursiveDelete ❌​F ❌​F ✅​p ✅​p ✅​p ✅​p
❌​ TestFilerRecursiveDelete/workspace_files_extensions ❌​F ❌​F ✅​p ✅​p ✅​p ✅​p
Top 50 slowest tests (at least 2 minutes):
duration env testname
36:15 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
21:42 azure linux-2core-8gb TestAccept/bundle/resources/postgres_projects/factcheck/update_mask_star
20:51 azure linux-2core-8gb TestAccept/bundle/resources/postgres_projects/factcheck/update_mask_spec
15:06 aws-windows-latest-4core-16gb TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=cluster.yml.tmpl/READPLAN=
14:17 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
13:52 aws-windows-latest-4core-16gb TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=cluster_libraries.yml.tmpl/READPLAN=
13:46 aws linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=cluster_libraries.yml.tmpl/READPLAN=1
12:26 aws linux-2core-8gb TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster_libraries.yml.tmpl/READPLAN=1
11:47 aws linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN=1
11:23 aws linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=cluster_libraries.yml.tmpl/READPLAN=
11:20 aws linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN=
11:03 aws linux-2core-8gb TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN=1
10:52 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
10:49 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
10:22 aws linux-2core-8gb TestAccept/bundle/invariant/delete_idempotent/DMS=/INPUT_CONFIG=cluster.yml.tmpl/READPLAN=
10:19 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
10:07 azure-windows-latest-4core-16gb TestAccept/bundle/resources/postgres_databases/recreate/DMS=true
9:51 aws-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
9:33 aws linux-2core-8gb TestAccept/bundle/resources/materialization_sets/batch/DMS=true
9:07 aws linux-2core-8gb TestAccept/pipelines/run/refresh-flags
9:03 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
8:50 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
8:45 azure-windows-latest-4core-16gb TestAccept/bundle/resources/postgres_synced_tables/basic/DMS=
8:41 azure-windows-latest-4core-16gb TestAccept/bundle/resources/postgres_synced_tables/recreate/DMS=true
8:22 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
8:20 aws-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
8:12 aws-windows-latest-4core-16gb TestAccept/bundle/invariant/no_drift/DMS=/INPUT_CONFIG=cluster_libraries.yml.tmpl/READPLAN=1
8:10 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
8:06 aws-windows-latest-4core-16gb TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster.yml.tmpl/READPLAN=1
7:59 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/deploy/local_ssd_count/DMS=true
7:57 aws-windows-latest-4core-16gb TestAccept/bundle/invariant/no_drift/DMS=/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN=
7:52 azure linux-2core-8gb TestAccept/bundle/config-remote-sync/multiple_resources/DMS=
7:49 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/deploy/local_ssd_count/DMS=
7:44 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
7:43 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
7:40 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
7:35 aws linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
7:27 aws linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=true
7:22 aws-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/lifecycle-started-toggle/DMS=true
7:22 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/clusters/deploy/local_ssd_count/DMS=
7:18 aws-windows-latest-4core-16gb TestAccept/bundle/invariant/no_drift/DMS=/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN=1
7:16 aws linux-2core-8gb TestAccept/bundle/config-remote-sync/multiple_resources/DMS=
7:15 azure linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
7:13 aws linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
7:10 aws-windows-latest-4core-16gb TestAccept/bundle/invariant/no_drift/DMS=/INPUT_CONFIG=cluster_libraries.yml.tmpl/READPLAN=
7:02 aws-windows-latest-4core-16gb TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster_apply_policy_default_values.yml.tmpl/READPLAN=1
7:02 gcp linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=
7:00 azure linux-2core-8gb TestAccept/bundle/resources/clusters/lifecycle-started/DMS=true
6:54 azure linux-2core-8gb TestAccept/bundle/resources/postgres_synced_tables/recreate/DMS=
6:53 azure linux-2core-8gb TestAccept/bundle/config-remote-sync/multiple_resources/DMS=true

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.

4 participants