diff --git a/databricks-sdk-java/src/main/java/com/databricks/sdk/core/UserAgent.java b/databricks-sdk-java/src/main/java/com/databricks/sdk/core/UserAgent.java index c7689853a..a04c68882 100644 --- a/databricks-sdk-java/src/main/java/com/databricks/sdk/core/UserAgent.java +++ b/databricks-sdk-java/src/main/java/com/databricks/sdk/core/UserAgent.java @@ -267,8 +267,6 @@ private static List listKnownAgents() { new KnownAgent("CLINE_ACTIVE", "cline"), // https://github.com/cline/cline (v3.24.0+) new KnownAgent("CODEX_CI", "codex"), // https://github.com/openai/codex new KnownAgent("COPILOT_CLI", "copilot-cli"), // https://github.com/features/copilot - // VS Code Copilot terminal; best-effort heuristic, not officially identified. - new KnownAgent("COPILOT_MODEL", "copilot-vscode"), new KnownAgent("CURSOR_AGENT", "cursor"), // Closed source new KnownAgent("GEMINI_CLI", "gemini-cli"), // https://google-gemini.github.io/gemini-cli new KnownAgent( @@ -277,6 +275,9 @@ private static List listKnownAgents() { new KnownAgent("KIRO", "kiro"), // https://kiro.dev/ (Amazon) new KnownAgent("OPENCLAW_SHELL", "openclaw"), // https://github.com/anthropics/openclaw new KnownAgent("OPENCODE", "opencode"), // https://github.com/opencode-ai/opencode + // Set by VS Code 1.121+ for agent-initiated terminal commands + // (https://code.visualstudio.com/updates/v1_121). + new KnownAgent("VSCODE_AGENT", "vscode-agent"), new KnownAgent("WINDSURF_AGENT", "windsurf")); // https://codeium.com/windsurf (Codeium) } @@ -310,13 +311,6 @@ private static String lookupAgentProvider(Environment env) { } } - // Known BYOK false positive: Copilot CLI users often set COPILOT_MODEL - // alongside COPILOT_CLI. Treat that pair as a single copilot-cli signal - // rather than a stacked multi-agent setup. - if (matches.contains("copilot-cli") && matches.contains("copilot-vscode")) { - matches.removeIf(m -> m.equals("copilot-vscode")); - } - if (matches.size() == 1) { return matches.get(0); } diff --git a/databricks-sdk-java/src/test/java/com/databricks/sdk/core/UserAgentTest.java b/databricks-sdk-java/src/test/java/com/databricks/sdk/core/UserAgentTest.java index 232409c84..0631a52f0 100644 --- a/databricks-sdk-java/src/test/java/com/databricks/sdk/core/UserAgentTest.java +++ b/databricks-sdk-java/src/test/java/com/databricks/sdk/core/UserAgentTest.java @@ -241,14 +241,14 @@ public void testAgentProviderAugment() { } @Test - public void testAgentProviderCopilotVscode() { + public void testAgentProviderVscodeAgent() { setupAgentEnv( new HashMap() { { - put("COPILOT_MODEL", "gpt-4"); + put("VSCODE_AGENT", "1"); } }); - Assertions.assertTrue(UserAgent.asString().contains("agent/copilot-vscode")); + Assertions.assertTrue(UserAgent.asString().contains("agent/vscode-agent")); } @Test @@ -415,30 +415,14 @@ public void testAgentProviderExplicitEnvWinsOverKnownAgentEnv() { } @Test - public void testAgentProviderCopilotCliAndCopilotVscodeCollapseToCopilotCli() { - // Copilot CLI users (BYOK mode) often set COPILOT_MODEL alongside - // COPILOT_CLI. Treat the pair as a single copilot-cli signal rather - // than a stacked multi-agent setup. + public void testAgentProviderVscodeAgentAndCopilotCliReportsMultiple() { + // VSCODE_AGENT can legitimately stack with other agents (e.g. running + // Copilot CLI from a VS Code agent terminal). setupAgentEnv( new HashMap() { { + put("VSCODE_AGENT", "1"); put("COPILOT_CLI", "1"); - put("COPILOT_MODEL", "gpt-4"); - } - }); - Assertions.assertTrue(UserAgent.asString().contains("agent/copilot-cli")); - } - - @Test - public void testAgentProviderCopilotByokCollapseStillMultiple() { - // The Copilot BYOK collapse only drops the copilot-vscode match. If - // another agent is also present, the result is still "multiple". - setupAgentEnv( - new HashMap() { - { - put("COPILOT_CLI", "1"); - put("COPILOT_MODEL", "gpt-4"); - put("CLAUDECODE", "1"); } }); Assertions.assertTrue(UserAgent.asString().contains("agent/multiple"));