Commit 484fe95
authored
Detect VS Code agent via VSCODE_AGENT, remove COPILOT_MODEL heuristic (#1697)
## Why
[VS Code 1.121](https://code.visualstudio.com/updates/v1_121) introduced
the `VSCODE_AGENT` environment 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_MODEL` and reported
`copilot-vscode`, but `COPILOT_MODEL` is 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 (drop
`copilot-vscode` whenever `COPILOT_CLI` was also set). Over the last 13
weeks, the heuristic identified 3 users / 52 events; `copilot-cli` saw
539 users / 175k events. The signal was effectively dead.
## Changes
- Add `VSCODE_AGENT` to the known agents list, reported as
`agent/vscode-agent`.
- Remove the `COPILOT_MODEL` to `copilot-vscode` mapping.
- Remove the `collapseCopilotBYOK` function. `VSCODE_AGENT` can
legitimately stack with `COPILOT_CLI` (e.g. running Copilot CLI from a
VS Code agent terminal), so the multi-agent path covers it without
special handling.
## Tests
- [x] Updated `agent_test.go`: new `vscode-agent` case, `VSCODE_AGENT +
COPILOT_CLI` stacks to `multiple`.
- [x] `make test` passes.
- [x] `make fmt lint` clean.
This PR mirrors parallel changes in
[databricks-sdk-py](databricks/databricks-sdk-py#1444),
[databricks-sdk-java](databricks/databricks-sdk-java#810),
and [sdk-js](databricks/sdk-js#152).
NO_CHANGELOG=true
---------
Signed-off-by: simon <simon.faltum@databricks.com>1 parent 85511e2 commit 484fe95
2 files changed
Lines changed: 8 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | 78 | | |
84 | 79 | | |
85 | 80 | | |
| |||
90 | 85 | | |
91 | 86 | | |
92 | 87 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | 88 | | |
117 | 89 | | |
118 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
180 | | - | |
181 | | - | |
| 179 | + | |
| 180 | + | |
182 | 181 | | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
| 182 | + | |
| 183 | + | |
190 | 184 | | |
191 | 185 | | |
192 | 186 | | |
| |||
0 commit comments