Skip to content

Narrow "not enabled" to 404, memoize the gateway probe, and quiet the sudo note - #1336

Open
guidobouman wants to merge 2 commits into
databricks:mainfrom
guidobouman:guido-b/gateway-probe-fixes
Open

guidobouman wants to merge 2 commits into
databricks:mainfrom
guidobouman:guido-b/gateway-probe-fixes

Conversation

@guidobouman

@guidobouman guidobouman commented Oct 28, 2026 •

Copy link
Copy Markdown

Summary

  • "Not enabled" only on 404. The launch preflight reports "Databricks Unity Gateway is not enabled on this workspace" only when the model-services probe returns HTTP 404. Any other non-transient, non-auth failure now says the gateway could not be verified, with the reason and the docs link. Before, those failures claimed the gateway was disabled. Auth, scope, permission and transient failures keep their existing messages.
  • Memoize the gateway probe. A successful probe is cached per workspace for the life of the process. ug codex configures once for auto-setup and again on the launch path. Re-probing a gateway that had just answered only gave the flaky model-services listing another chance to fail. Failures are never cached.
  • Quieter sudo note. The "Enter password to configure ..." note is skipped when sudo is passwordless, where it was misleading. Writes behave exactly as before.

The probe's retry of transient errors now comes from #1246, so this PR no longer changes retry or timeout behavior.

Tests

  • A 404 reports "not enabled". A non-404, non-transient failure reports "could not verify", without "not enabled" or "transient".
  • Successful probes are memoized per workspace and failures are not. A second configure_shared_state in one process doesn't re-probe.
  • The sudo note is skipped when sudo is passwordless and shown otherwise.
  • ruff format, ruff check and ty check are clean.
  • The full suite passes except for 11 environment-dependent failures (test_agents_init.py::TestInstallToolBinary, test_e2e_user_agent.py, test_smart_router.py). Before the rebase, the same 11 also failed on an unmodified checkout.

This pull request and its description were written by Isaac.

@guidobouman
guidobouman marked this pull request as ready for review October 28, 2026 11:34
@lilly-luo
lilly-luo self-requested a review October 28, 2026 11:40
@lilly-luo lilly-luo added the ug-review Run the automated UG review label Oct 28, 2026

@lilly-luo lilly-luo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice fix overall. The 404-only "not enabled" message and the probe memoization both address real UX problems, and the tests cover the new paths well. A few things to look at:

  • Retries have no backoff (databricks.py:2177): the probe now retries 429 and 5xx back-to-back, with no Retry-After handling, against an endpoint we already know is overloaded.
  • Worst-case latency (databricks.py:3748): the comment says the worst case stays near the old 10s, but a hanging page 0 now takes about 40s under the spinner.
  • Other definitive 4xx errors fall into the "transient" message (databricks.py:3845): worth confirming what a workspace without UG actually returns.
  • Cache key (databricks.py:3827): keyed on workspace only, and it also caches empty/inconclusive "reachable" results. Fine for today's single-profile flow; a short note or a (workspace, token) key would make that explicit.
  • Nit: the test_cli.py reformat of the HTTP 401 tuple is unrelated churn.

The sudo-note change looks good to me. As a side benefit, sudo -n true succeeds as root, so the note no longer appears when ug runs as root either.

Comment thread src/ucode/databricks.py Outdated
Comment thread src/ucode/databricks.py
Comment thread src/ucode/databricks.py Outdated
Comment thread src/ucode/databricks.py Outdated
@guidobouman guidobouman changed the title Retry the gateway probe on transient failures, fix its error message, and quiet the sudo note Narrow "not enabled" to 404, memoize the gateway probe, and quiet the sudo note Oct 28, 2026
@guidobouman
guidobouman force-pushed the guido-b/gateway-probe-fixes branch from 6d3f2d9 to 9654f2c Compare October 28, 2026 20:11

@lilly-luo lilly-luo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we just landed a change that fixes the 499 transient issue here: #1246

can you scope this down to just the sudo note?

@guidobouman

Copy link
Copy Markdown
Author

Scoped it down, but think this set still makes sense. Your take?

@guidobouman

Copy link
Copy Markdown
Author

Thanks for the approval, @lilly-luo! I don't have write access to this repo, so I can't add it to the merge queue myself. Could you queue it when you get a chance?

guidobouman and others added 2 commits October 29, 2026 22:43
… sudo note

- Only an HTTP 404 from the model-services probe is reported as "not enabled
  on this workspace". Any other non-transient, non-auth failure now says the
  gateway could not be verified, without claiming it is disabled or transient.
- Memoize successful gateway probes per workspace for the process, so the
  second configure pass (auto-setup, then launch) does not re-probe a gateway
  that just answered. Failures are never cached.
- Skip the "Enter password" note when sudo is passwordless.

The probe's retry of transient errors comes from databricks#1246; this change does not
alter it.

Co-authored-by: Isaac <no-reply@databricks.com>
…cessible results

Co-authored-by: Isaac <no-reply@databricks.com>
@guidobouman
guidobouman force-pushed the guido-b/gateway-probe-fixes branch from b2c0137 to f4abce1 Compare October 29, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ug-review Run the automated UG review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants