Skip to content

acceptance: unset all SDK-known AI-agent env vars before tests#5425

Closed
janniklasrose wants to merge 1 commit into
mainfrom
janniklasrose/agent-env-vars
Closed

acceptance: unset all SDK-known AI-agent env vars before tests#5425
janniklasrose wants to merge 1 commit into
mainfrom
janniklasrose/agent-env-vars

Conversation

@janniklasrose
Copy link
Copy Markdown
Contributor

@janniklasrose janniklasrose commented Jun 3, 2026

Changes

  • Sync knownAgents with SDK's useragent.listKnownAgents
  • Add AGENT and AI_AGENT to env variable to drop during acceptance test

Why

Local test failures when run from agents.

The SDK derives its user-agent from agent-detection env vars and, since v0.132.0, treats even empty values as present, so clearing them via test.toml does not help. The previous list covered only a subset, leaving acceptance output dependent on which agent launched the test runner. Expand it to mirror useragent.listKnownAgents and split the generic AGENT/AI_AGENT fallback vars into their own list.

Tests

Local & CI

Previously, tests were failing with e.g.

--- FAIL: TestAccept (26.14s)
    --- FAIL: TestAccept/bundle/user_agent/simple
        --- FAIL: TestAccept/bundle/user_agent/simple/DATABRICKS_BUNDLE_ENGINE=direct (1.74s)
            acceptance_test.go:926: Diff:
                --- bundle/user_agent/simple/out.requests.validate.direct.json
                +++ .../out.requests.validate.direct.json
                @@ -1,7 +1,7 @@
                 {
                   "headers": {
                     "User-Agent": [
                -      "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_validate cmd-exec-id/[UUID] interactive/none auth/pat"
                +      "cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/bundle_validate cmd-exec-id/[UUID] interactive/none auth/pat agent/claude-code_2-1-162_agent"
                     ]
                   },
                   "method": "GET",

Co-authored-by: Isaac

The SDK derives its user-agent from agent-detection env vars and, since v0.132.0, treats even empty values as present, so clearing them via test.toml does not help. The previous list covered only a subset, leaving acceptance output dependent on which agent launched the test runner. Expand it to mirror useragent.listKnownAgents and split the generic AGENT/AI_AGENT fallback vars into their own list.

Co-authored-by: Isaac
@eng-dev-ecosystem-bot
Copy link
Copy Markdown
Collaborator

Commit: 33e3d92

Run: 26891754895

@janniklasrose janniklasrose requested a review from simonfaltum June 4, 2026 06:28
@janniklasrose janniklasrose marked this pull request as ready for review June 4, 2026 06:28
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Waiting for approval

Based on git history, these people are best suited to review:

  • @denik -- recent work in acceptance/

Eligible reviewers: @andrewnester, @anton-107, @pietern, @renaudhartert-db, @shreyas-goenka, @simonfaltum

Suggestions based on git history. See OWNERS for ownership rules.

@janniklasrose janniklasrose requested a review from denik June 4, 2026 06:31
Comment on lines +205 to +206
// Keep this list in sync with the SDK's useragent.listKnownAgents.
knownAgents := []string{
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can consider exporting this from SDK. We can also skip updating knownAgents and limit to the ones we actually use day to day, since AGENT and AI_AGENT are the key change here

@janniklasrose
Copy link
Copy Markdown
Contributor Author

covered by #5436

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.

2 participants