Detect VS Code agent via VSCODE_AGENT, remove COPILOT_MODEL heuristic#810
Open
simonfaltum wants to merge 4 commits into
Open
Detect VS Code agent via VSCODE_AGENT, remove COPILOT_MODEL heuristic#810simonfaltum wants to merge 4 commits into
simonfaltum wants to merge 4 commits into
Conversation
VS Code 1.121+ sets VSCODE_AGENT for agent-initiated terminal commands. Detect it as `vscode-agent` in the User-Agent header. The previous COPILOT_MODEL heuristic reported `copilot-vscode` but COPILOT_MODEL is set by Copilot CLI BYOK users, not specifically by VS Code. The BYOK collapse logic (drop copilot-vscode when COPILOT_CLI is also set) is removed alongside the heuristic; VSCODE_AGENT can legitimately stack with COPILOT_CLI, which now correctly reports `multiple`. See: https://code.visualstudio.com/updates/v1_121
hectorcast-db
approved these changes
May 26, 2026
Co-authored-by: Isaac
Contributor
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
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
VS Code 1.121 introduced the
VSCODE_AGENTenvironment variable, set for any agent-initiated terminal command (Copilot Chat agent mode and other agent extensions). This is the official signal for VS Code agent usage.The previous heuristic detected
COPILOT_MODELand reportedcopilot-vscode, butCOPILOT_MODELis actually set by Copilot CLI users who bring their own key, not specifically by VS Code. This produced false positives and required a BYOK collapse workaround (dropcopilot-vscodewheneverCOPILOT_CLIwas also set). Over the last 13 weeks, the heuristic identified 3 users / 52 events;copilot-clisaw 539 users / 175k events. The signal was effectively dead.Changes
VSCODE_AGENTtolistKnownAgents(), reported asagent/vscode-agent.COPILOT_MODELtocopilot-vscodemapping.VSCODE_AGENTcan legitimately stack withCOPILOT_CLI(e.g. running Copilot CLI from a VS Code agent terminal), so the multi-agent path covers it without special handling.Tests
UserAgentTest.java: newtestAgentProviderVscodeAgentand stacking test.mvn test -Dtest=UserAgentTestpasses (40 tests, 0 failures).make fmtclean.This PR mirrors parallel changes in databricks-sdk-go, databricks-sdk-py, and sdk-js.
NO_CHANGELOG=true