Commit a2ea56c
authored
Detect VS Code agent via VSCODE_AGENT, remove COPILOT_MODEL heuristic (databricks#810)
## 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 `listKnownAgents()`, 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 `UserAgentTest.java`: new `testAgentProviderVscodeAgent`
and stacking test.
- [x] `mvn test -Dtest=UserAgentTest` passes (40 tests, 0 failures).
- [x] `make fmt` clean.
This PR mirrors parallel changes in
[databricks-sdk-go](databricks/databricks-sdk-go#1697),
[databricks-sdk-py](databricks/databricks-sdk-py#1444),
and [sdk-js](databricks/sdk-js#152).
NO_CHANGELOG=true1 parent 311d530 commit a2ea56c
2 files changed
Lines changed: 10 additions & 32 deletions
File tree
- databricks-sdk-java/src
- main/java/com/databricks/sdk/core
- test/java/com/databricks/sdk/core
Lines changed: 3 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
271 | | - | |
272 | 270 | | |
273 | 271 | | |
274 | 272 | | |
| |||
277 | 275 | | |
278 | 276 | | |
279 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
| |||
310 | 311 | | |
311 | 312 | | |
312 | 313 | | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | 314 | | |
321 | 315 | | |
322 | 316 | | |
| |||
Lines changed: 7 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
| 244 | + | |
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
| 251 | + | |
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
422 | 421 | | |
423 | 422 | | |
424 | 423 | | |
| 424 | + | |
425 | 425 | | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | 426 | | |
443 | 427 | | |
444 | 428 | | |
| |||
0 commit comments