Bump Go SDK to v0.126.0, remove redundant agent tracking#4799
Merged
simonfaltum merged 19 commits intomainfrom Mar 20, 2026
Merged
Bump Go SDK to v0.126.0, remove redundant agent tracking#4799simonfaltum merged 19 commits intomainfrom
simonfaltum merged 19 commits intomainfrom
Conversation
The Go SDK now includes built-in AI agent detection, appending agent/<name> to the User-Agent header when running inside a known agent environment. This removes the CLI's own agent-to-UA wiring which would produce duplicate agent/ segments. Hand-written changes: - Remove withAgentInUserAgent() from root command (cmd/root/user_agent_agent.go) - Remove agent.Detect(ctx) from Execute() and delete libs/agent/ (dead code) - Add HTTP-level tests verifying SDK agent detection produces exactly one agent/ segment in the User-Agent header - Update auth prompt logic to use cfg.ConfigType() instead of ErrNotAccountClient/ErrNotWorkspaceClient (the SDK no longer returns these errors after removing host-type validation in favor of host metadata resolution) - Add .well-known/databricks-config handlers to labs test mock servers Generated changes from make generate with updated OpenAPI SHA. Co-authored-by: Isaac
denik
reviewed
Mar 20, 2026
make generate overwrote tagging.yml with older action versions from the universe template. Revert to keep the Renovate-bumped versions (v3/v6). Also revert a spurious mode change on tagging.py. Co-authored-by: Isaac
Contributor
|
In "Test plan", can you include '"make generate" was run on final commit and produced no diff'? |
Collaborator
|
Commit: 0a5aad8
19 interesting tests: 9 SKIP, 7 KNOWN, 2 flaky, 1 RECOVERED
Top 25 slowest tests (at least 2 minutes):
|
This reverts commit 11c2cc1.
…ompting is unavailable The SDK v0.126.0 bump replaced ErrNotAccountClient/ErrNotWorkspaceClient sentinel errors with host metadata resolution. The initial migration used ConfigType() which misclassifies unified hosts as InvalidConfig. Switch to HostType() and handle UnifiedHost explicitly. Also fix the case where needsPrompt is true but prompting is disabled: synthesize the appropriate sentinel error instead of silently returning a wrong-type client. Co-authored-by: Isaac
The SDK removed host-type validation from NewAccountClient/NewWorkspaceClient in favor of host metadata resolution. This broke the CLI's auth prompt logic which relied on ErrNotAccountClient/ErrNotWorkspaceClient sentinels. Fixes: - Use cfg.HostType() instead of cfg.ConfigType() to detect wrong host type, with explicit handling for UnifiedHost - Synthesize ErrNotAccountClient/ErrNotWorkspaceClient when the config is for the wrong host type and prompting is unavailable, preserving the MustAnyClient fallthrough and giving actionable errors - Add tests for wrong-type configs with prompting disabled - Fix noNetworkTransport comment and MustAnyClient comment Also fix whitespace in generated environments.go. Co-authored-by: Isaac
Fixes staticcheck SA1019 lint warning. Co-authored-by: Isaac
pietern
reviewed
Mar 20, 2026
The SDK v0.126.0 resolves host metadata from /.well-known/databricks-config during config initialization. Register a default handler in testserver.New() so all test servers (both unit and acceptance) handle this endpoint without requiring per-test configuration. Regenerated acceptance test golden files to include the new request. Co-authored-by: Isaac
pietern
reviewed
Mar 20, 2026
When auth succeeds, return early instead of checking HostType() to decide whether to prompt or error. HostType() is a URL-pattern heuristic that returns WorkspaceHost for unified host URLs, causing false negatives for account clients on unified hosts. The SDK's auth resolution (which includes .well-known/databricks-config metadata lookups) is the source of truth. Co-authored-by: Isaac
The user_agent test output now includes the .well-known/databricks-config request. The telemetry deploy test has non-deterministic request ordering that differs between terraform and direct engine variants. Co-authored-by: Isaac
- Revert tagging.yml and tagging.py to main (no version downgrades or mode changes from codegen) - Remove user_agent_agent_test.go per reviewer feedback (we don't test other SDK-injected UA bits, no need to test this one) - Fix govet nilness lint in workspaceClientOrPrompt: simplify needsPrompt logic to avoid tautological/impossible nil checks after the early return on successful auth Co-authored-by: Isaac
Only synthesize ErrNotWorkspaceClient when the host type is actually wrong (AccountHost). For other auth errors like ErrCannotConfigureDefault, return the original error to preserve actionable error messages. Also add replacement rules for platform-specific DNS resolver details in auth switch/profiles acceptance tests (Linux includes "on 127.0.0.53:53", macOS does not). Co-authored-by: Isaac
The .well-known/databricks-config request (added by the SDK bump) became the first recorded request in out.requests.txt. Since it lacks a cmd-exec-id in User-Agent, extract_command_exec_id.py failed on its first JSON object. Fix the script to iterate through all objects until finding one with cmd-exec-id. Also add a Repls pattern for compact JSON execution_time_ms (no space after colon, as it appears in protoLogs strings) and regenerate all affected golden files. For pydabs/check-formatting, regenerate with ruff installed so the output reflects actual formatting checks. Co-authored-by: Isaac
…-config The SDK bump introduced host metadata resolution during EnsureResolved(), which fetches /.well-known/databricks-config from each profile's host. The test used fake DNS hostnames that caused non-deterministic warning ordering. Fix by adding a default handler for the endpoint and pointing test profiles at the mock server. Co-authored-by: Isaac
Suggested reviewersBased on git history of the changed files, these people are best suited to review:
Confidence: medium Eligible reviewersBased on CODEOWNERS, these people or teams could also review: @alexott, @anton-107, @databricks/eng-apps-devex, @nfx, @shreyas-goenka Suggestions based on git history of 108 changed files (38 scored). See CODEOWNERS for path-specific ownership rules. |
renaudhartert-db
approved these changes
Mar 20, 2026
denik
reviewed
Mar 20, 2026
…s-config requests
1b87b08 to
ae58ec5
Compare
- Exclude tagging.yml dependencies from dependabot (externally managed) - Redact .well-known host metadata warnings in auth/bundle_and_profile test - Consolidate .well-known handler: use consistent workspace_id (470123456789500), remove duplicate handler from handlers.go Co-authored-by: Isaac
…/databricks-config requests Co-authored-by: Isaac
…io expected output The SDK caches the .well-known response per client, so consecutive HTTP requests within a single CLI command (fs cp, fs rm) do not each produce a separate .well-known lookup. Removed the extra entries before the second HEAD, PUT, and DELETE requests in the upload and delete sections. Co-authored-by: Isaac
Collaborator
|
Commit: 410853a
45 interesting tests: 22 RECOVERED, 16 flaky, 3 KNOWN, 3 FAIL, 1 SKIP
Top 50 slowest tests (at least 2 minutes):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Go SDK now includes built-in AI agent detection (PR databricks/databricks-sdk-go#1537). It appends
agent/<name>to the User-Agent header when running inside a known agent environment. The CLI had its own agent-to-UA wiring that did the same thing, which would now produce duplicateagent/segments.Changes
Before: The CLI detected agents via
libs/agentand injectedagent/<name>into the UA string inPersistentPreRunE. The SDK had no agent detection.Now: The SDK handles agent detection natively. The CLI's redundant wiring is removed.
Specific changes:
cmd/root/user_agent_agent.go(thewithAgentInUserAgentfunction)libs/agent/package (dead code after removal)agent.Detect(ctx)fromExecute()in root.goagent/segmentcfg.HostType()instead ofErrNotAccountClient/ErrNotWorkspaceClient(the SDK removed host-type validation from client constructors in favor of host metadata resolution). Synthesize sentinel errors when prompting is unavailable to preserveMustAnyClientfallthrough behavior..well-known/databricks-confighandler to the default test server, so acceptance tests with custom profiles don't produce non-deterministic host metadata warningsauth/switch/nominaltest to point profiles at the mock server instead of fake DNS hostnames.well-known/databricks-confighandlers to labs test mock serversmake generatewith updated OpenAPI SHATest plan
TestSDKAgentDetection: exactly oneagent/claude-codein UA headerTestSDKNoAgentDetected: noagent/when no agent env vars setTestSDKMultipleAgentsSuppressed: noagent/when multiple agents detectedTestAccountClientOrPromptandTestWorkspaceClientOrPromptpassTestAccountClientOrPromptReturnsErrorForWrongHostType: wrong host type with prompting disabled returnsErrNotAccountClientTestWorkspaceClientOrPromptReturnsErrorForWrongHostType: wrong host type with prompting disabled returnsErrNotWorkspaceClientTestAccountClientOrPromptReturnsErrorForMissingAccountID: missing account ID with prompting disabled returnsErrNotAccountClientcmd/labs/projecttests passexperimental/aitoolstests passmake checkspassesmake generateon final commit produces no diffThis pull request was AI-assisted by Isaac.