Commit 04fa424
committed
Make explicit env vars win over AGENT fallback in agent detection
Previously, agents like amp and goose had dual matchers: their explicit
env var (AMP_CURRENT_THREAD_ID, GOOSE_TERMINAL) plus AGENT=<name>. This
caused asymmetric ambiguity: AGENT=goose + CLAUDECODE=1 resolved to ""
(both matchers fired on different products), while AGENT=cursor +
CLAUDECODE=1 resolved to "claude-code" (only claude-code matched,
cursor was handled by the AGENT fallback which does not trigger once
an explicit matcher has fired).
The rule is now uniform: explicit env var matchers always take
precedence over the generic AGENT=<name> signal. AGENT is treated
purely as a fallback for agents without an explicit matcher, or for
products we do not yet specifically recognize.
Changes:
- Remove per-agent AGENT=<name> matchers from amp and goose entries.
Those products still set AGENT=<name>; the central fallback in
lookupAgentProvider handles them.
- Update the lookupAgentProvider doc comment to reflect the new rule.
- Flip the existing AGENT=goose + CLAUDECODE=1 test to expect
"claude-code" and rename accordingly.
- Add test for GOOSE_TERMINAL=1 + AGENT=cursor -> "goose".
- Add test for COPILOT_CLI=1 + COPILOT_MODEL=gpt-4 -> "" (documents
the known, intentional ambiguity for Copilot CLI BYOK users).
- Update NEXT_CHANGELOG entry to mention precedence rule.
Signed-off-by: simon <simon.faltum@databricks.com>1 parent e9c4eaa commit 04fa424
3 files changed
Lines changed: 51 additions & 11 deletions
File tree
- databricks-sdk-java/src
- main/java/com/databricks/sdk/core
- test/java/com/databricks/sdk/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
Lines changed: 14 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
| 298 | + | |
298 | 299 | | |
299 | 300 | | |
300 | | - | |
301 | | - | |
302 | | - | |
| 301 | + | |
| 302 | + | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
| 336 | + | |
336 | 337 | | |
337 | 338 | | |
338 | | - | |
339 | | - | |
340 | | - | |
| 339 | + | |
| 340 | + | |
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
360 | 365 | | |
361 | 366 | | |
362 | 367 | | |
| |||
367 | 372 | | |
368 | 373 | | |
369 | 374 | | |
370 | | - | |
371 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
372 | 378 | | |
373 | 379 | | |
374 | 380 | | |
| |||
Lines changed: 36 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
389 | | - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
390 | 391 | | |
391 | 392 | | |
392 | 393 | | |
393 | 394 | | |
394 | 395 | | |
395 | 396 | | |
396 | 397 | | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
397 | 431 | | |
398 | 432 | | |
399 | 433 | | |
| |||
0 commit comments