Commit 6235813
authored
Detect VS Code agent via VSCODE_AGENT, remove COPILOT_MODEL heuristic (#1444)
## 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 `_KNOWN_AGENTS`, reported as
`agent/vscode-agent`.
- Remove the `COPILOT_MODEL` to `copilot-vscode` mapping.
- Remove the BYOK collapse logic. `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 `tests/test_user_agent.py`: new `vscode-agent` case,
`VSCODE_AGENT + COPILOT_CLI` stacks to `multiple`.
- [x] `pytest tests/test_user_agent.py` passes (42 tests).
- [x] `make fmt` clean.
This PR mirrors parallel changes in
[databricks-sdk-go](databricks/databricks-sdk-go#1697),
[databricks-sdk-java](databricks/databricks-sdk-java#810),
and [sdk-js](databricks/sdk-js#152).
NO_CHANGELOG=true1 parent 51de41f commit 6235813
2 files changed
Lines changed: 10 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | 247 | | |
251 | 248 | | |
252 | 249 | | |
| |||
255 | 252 | | |
256 | 253 | | |
257 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | 294 | | |
301 | 295 | | |
302 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | | - | |
| 238 | + | |
| 239 | + | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
| 242 | + | |
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
341 | 341 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | 342 | | |
355 | 343 | | |
356 | 344 | | |
| |||
0 commit comments