Repository navigation
Conversation
Adds a closed AitoolsAgentType enum for the agent calling the CLI (the 10 registry agents, the 6 SDK-only agents, plus UNKNOWN / MULTIPLE / NONE), the SDK agent -> registry mapping in libs/aitools/agents, and sets calling_agent on AitoolsInstallEvent. Free-text AGENT / AI_AGENT values are never sent. Co-authored-by: Isaac <no-reply@databricks.com>
✅ Integration test reportCommit: 6b14bd3
Top 3 slowest tests (at least 2 minutes):
|
Pull request was closed
|
closed as unnecessary |
simonfaltum
left a comment
There was a problem hiding this comment.
No blocking issues found in the reviewed commit. The focused agent, telemetry, and aitools tests passed. The inline comments are nonblocking documentation and cleanup suggestions.
|
|
||
| // ProviderAgentType maps an SDK agent product to the closed telemetry enum. | ||
| // Free text from the AGENT / AI_AGENT env vars, and products a newer SDK | ||
| // detects, become UNKNOWN, so the raw value never leaves the machine. |
There was a problem hiding this comment.
[nice to have] This comment overstates the guarantee: AGENT=cursor becomes CURSOR, and an unknown AGENT value still travels in the SDK's HTTP User-Agent. Please say that recognized product names map to enums and other values to UNKNOWN, so this JSON field never contains free-form text.
| // process-wide AgentProvider cache before and after the test. With no | ||
| // arguments AgentProvider() reports no agent. Tests using it must not run in | ||
| // parallel. | ||
| func SetAgentEnv(t *testing.T, kv ...string) { |
There was a problem hiding this comment.
[nice to have] internal/testutil.SetAgent already clears the environment and resets the SDK's agent cache. These tests can use testutil.SetAgent(t, "") followed by the relevant t.Setenv calls, avoiding another manually maintained SDK environment-variable list.
| // CallingAgent returns the registry agent driving the CLI, or nil when no | ||
| // agent is detected, several are, or the agent is one the CLI cannot install | ||
| // into. | ||
| func CallingAgent() *Agent { |
There was a problem hiding this comment.
[nice to have] CallingAgent() currently has only test callers, and AgentForProvider has no production consumer outside this package. Consider dropping CallingAgent and keeping the provider lookup unexported until there is a production caller.
Summary
aitools installtelemetry now records which coding agent ran the CLI, as a closed enum.logInstallEvent AitoolsInstallEvent{ Agents: [install targets] AgentResults: ... + CallingAgent: agents.CallingAgentType() }The SDK's agent list (
listKnownAgents) is unexported, soagenttest.agentEnvVarsand the product list inTestProviderAgentTypeare copied by hand. A comment at each says what to update on an SDK bump. Until someone updates them, an agent that only a newer SDK detects is sent asUNKNOWN.Evidence
TestLogInstallEventSendsCallingAgentrunslogInstallEvent, uploads throughtelemetry.Uploadto a local/telemetry-exttest server, and readscalling_agentfrom the payload.CallingAgent:assignment removed):The test clears
DATABRICKS_CLI_DISABLE_TELEMETRY/DATABRICKS_CLI_TELEMETRY_TIMEOUTand pins PAT auth, so the runner's environment does not affect it. Also run:go testforlibs/aitools/...,cmd/aitools,libs/telemetry/..., and the aitools acceptance tests.Merge Danger
Door: two-way
Adds one telemetry field and some enum values. A revert removes them. Events that were already sent keep the field.
Blast Radius: telemetry-only
This changes only the payload of the
aitools installevent. Install behaviour does not change. Agent names are sent only as enum values, never as raw env-var text.This pull request and its description were written by Isaac.