Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ func testAccept(t *testing.T, inprocessMode bool, selectedTests []string, skipTo
// so a host value would add skill/ pairs to recorded user agents.
os.Unsetenv("DATABRICKS_SKILLS_INVOKED") //nolint:usetesting // t.Setenv cannot unset

// DATABRICKS_NOT_AN_AGENT hides the calling agent from the CLI. A host value would drop the nudges
// that the goldens expect, so the acceptance run starts without it.
os.Unsetenv("DATABRICKS_NOT_AN_AGENT") //nolint:usetesting // t.Setenv cannot unset

if !requirePrerequisites(t) {
// Don't run the suite against a stale toolchain; the failed subtest
// has already marked the parent test as failed.
Expand Down
1 change: 1 addition & 0 deletions acceptance/cmd/aitools/not-an-agent/out.test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cloud = false
54 changes: 54 additions & 0 deletions acceptance/cmd/aitools/not-an-agent/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

=== Claude Code is hinted, and its help and quickstart are the agent ones

>>> CLAUDECODE=1 [CLI] jobs list
Before you work with Databricks, run: databricks skills list

>>> CLAUDECODE=1 [CLI] fs --help

Coding agents: read the skills for this command group before you use it.
databricks skills read demo-skill

>>> CLAUDECODE=1 [CLI] --help

Coding agents: run `databricks skills list` to find skills for the commands you use.

>>> CLAUDECODE=1 [CLI] quickstart

=== With the variable set, no hint is printed

>>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] jobs list

=== Without the variable, the hint still shows on the same session

>>> CLAUDECODE=1 [CLI] jobs list
Before you work with Databricks, run: databricks skills list

=== With the variable set, the help has no skills footer

>>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] fs --help
-t, --target string bundle target to use (if applicable)

Use "databricks fs [command] --help" for more information about a command.

>>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] --help

Use "databricks [command] --help" for more information about a command.

=== With the variable set, quickstart prints the human guide

>>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] quickstart
# Welcome to Databricks

>>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] quickstart

=== With the variable set, auto-install enable says it is still stopped here

>>> DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 [CLI] aitools auto-install enable
Automatic installation of Databricks AI tools is enabled.
DATABRICKS_NOT_AN_AGENT still stops it in this environment; unset it to let it run.

=== A false value leaves agent detection on

>>> DATABRICKS_NOT_AN_AGENT=0 CODEX_CI=1 CODEX_THREAD_ID=thread-1 [CLI] jobs list
Before you work with Databricks, run: databricks skills list
40 changes: 40 additions & 0 deletions acceptance/cmd/aitools/not-an-agent/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# DATABRICKS_NOT_AN_AGENT makes agent detection report no agent, so a run that
# has an agent variable set gets the human output. Claude Code's variable is set
# throughout; the skills catalog is the one cmd/skills fixture, which maps the fs group.
sethome ./home
export DATABRICKS_SKILLS_DIR="$TESTDIR/../../skills/release"
unset XDG_CONFIG_HOME
# Claude Code's per-session throttle keys the hint by this id. Without it a
# machine with no session id (CI) prints the hint on every call, so pin it.
export CLAUDE_CODE_SESSION_ID=session-1

title "Claude Code is hinted, and its help and quickstart are the agent ones"
trace CLAUDECODE=1 $CLI jobs list
trace CLAUDECODE=1 $CLI fs --help | tail -n 3
trace CLAUDECODE=1 $CLI --help | tail -n 2
trace CLAUDECODE=1 $CLI quickstart | contains.py 'databricks skills list' > LOG.quickstart-agent

# The positive control above recorded session-1's hint throttle. The variable steps
# get a fresh session, so a build that ignored the variable would print the hint here.
export CLAUDE_CODE_SESSION_ID=session-2

title "With the variable set, no hint is printed"
trace DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 $CLI jobs list

# The same session without the variable still gets the hint, so the run above wrote no throttle marker.
title "Without the variable, the hint still shows on the same session"
trace CLAUDECODE=1 $CLI jobs list

title "With the variable set, the help has no skills footer"
trace DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 $CLI fs --help | tail -n 3
trace DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 $CLI --help | tail -n 2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nice to have] Nothing in this script runs root --help without the variable. This step would still pass if rootSkillsHint were never printed for some other reason. The fs --help and quickstart steps do have a run without the variable. Can you add trace CLAUDECODE=1 $CLI --help | tail -n 2 to the first section, so the golden shows the line there and shows it missing here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. The first section now runs CLAUDECODE=1 $CLI --help | tail -n 2, so the golden shows the skills line there, and the variable section shows it missing.


title "With the variable set, quickstart prints the human guide"
trace DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 $CLI quickstart | head -n 1
trace DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 $CLI quickstart | contains.py '!databricks skills list' > LOG.quickstart-human

title "With the variable set, auto-install enable says it is still stopped here"
trace DATABRICKS_NOT_AN_AGENT=1 CLAUDECODE=1 $CLI aitools auto-install enable

title "A false value leaves agent detection on"
trace DATABRICKS_NOT_AN_AGENT=0 CODEX_CI=1 CODEX_THREAD_ID=thread-1 $CLI jobs list

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] This control uses a new agent and thread (CODEX_CI=1 CODEX_THREAD_ID=thread-1). So no step shows that the variable-set runs on session-2 wrote no throttle marker. A regression that hides the hint but still writes the marker passes this test. Add a CLAUDECODE=1 $CLI jobs list step on session-2 with the variable unset, and expect the hint.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 1077d97, and the golden is regenerated. After the variable run on session-2, a step runs CLAUDECODE=1 jobs list with the variable unset, and the golden shows the hint there, so the variable run wrote no throttle marker.

5 changes: 5 additions & 0 deletions acceptance/cmd/aitools/not-an-agent/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Env.DATABRICKS_SKILLS_PREVIEW = "1"
Env.DATABRICKS_SKILLS_HINTS = "1"
# The throttle markers live in the file cache, which a host could disable.
Env.DATABRICKS_CACHE_ENABLED = "true"
Ignore = ["home"]
4 changes: 4 additions & 0 deletions cmd/aitools/autoinstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"

"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/agent"
"github.com/databricks/cli/libs/aitools/autoinstall"
"github.com/databricks/cli/libs/cmdio"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -75,4 +76,7 @@ func printAutoInstallSetting(ctx context.Context, enabled bool) {
if autoinstall.EnvOptedOut(ctx) {
cmdio.LogString(ctx, cmdio.Yellow(ctx, autoinstall.EnvVar+" still disables it in this environment; unset it to let it run."))
}
if agent.NotAnAgent(ctx) {
cmdio.LogString(ctx, cmdio.Yellow(ctx, agent.NotAnAgentEnv+" still stops it in this environment; unset it to let it run."))
}
}
6 changes: 6 additions & 0 deletions cmd/aitools/autoinstall_ask.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"
"time"

"github.com/databricks/cli/libs/agent"
"github.com/databricks/cli/libs/aitools/autoinstall"
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/log"
Expand Down Expand Up @@ -97,6 +98,11 @@ func askAtLogin(ctx context.Context, skippedCommand bool) loginAnswer {
if !cmdio.IsPromptSupported(ctx) || useragent.AgentProvider() != "" {
return loginAnswer{}
}
// A run that does not notice agents (DATABRICKS_NOT_AN_AGENT) never auto-installs (see AutoInstall), so a
// "yes" would promise what it does not do.
if agent.NotAnAgent(ctx) {
return loginAnswer{}
}
in := autoInstallInputs(ctx, skippedCommand)
if !autoinstall.Eligible(in) {
return loginAnswer{}
Expand Down
1 change: 1 addition & 0 deletions cmd/aitools/autoinstall_ask_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ func TestAskAtLogin(t *testing.T) {
{name: "redirected stderr does not ask", input: "\n", term: loginTerminal{stderrRedirected: true}},
{name: "TERM=dumb does not ask", input: "\n", env: []string{"TERM", "dumb"}},
{name: "a coding agent does not ask", input: "\n", env: []string{"CLAUDECODE", "1"}},
{name: "DATABRICKS_NOT_AN_AGENT does not ask", input: "\n", env: []string{"DATABRICKS_NOT_AN_AGENT", "1"}},
{name: "CI does not ask", input: "\n", env: []string{"CI", "true"}},
{name: "the environment opt-out does not ask", input: "\n", env: []string{autoinstall.EnvVar, "false"}},
{name: "a development build does not ask", input: "\n", env: []string{"DATABRICKS_AITOOLS_AUTO_INSTALL_CLI_VERSION", "1.30.0-dev+abcdef123456"}},
Expand Down
9 changes: 7 additions & 2 deletions cmd/aitools/autoinstall_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"strings"
"time"

"github.com/databricks/cli/libs/agent"
"github.com/databricks/cli/libs/aitools/agents"
"github.com/databricks/cli/libs/aitools/autoinstall"
"github.com/databricks/cli/libs/aitools/installer"
Expand All @@ -29,7 +30,6 @@ import (
"github.com/databricks/cli/libs/telemetry"
"github.com/databricks/cli/libs/telemetry/protos"
"github.com/databricks/cli/libs/versioncheck"
"github.com/databricks/databricks-sdk-go/useragent"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -114,6 +114,11 @@ func AutoInstall(cmd *cobra.Command) os.Signal {
if sig := loginAnswerOf(ctx).sig; sig != nil {
return sig
}
// A run that does not notice agents (DATABRICKS_NOT_AN_AGENT) installs nothing and asks nothing, so an eval
// baseline keeps its machine as it is.
if agent.NotAnAgent(ctx) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nice to have] This skip sits outside autoinstall.Decide/Inputs, which hold every other skip reason (OnRuntime, CI, EnvOptOut, RootInUserHome), so the code that explains the setting never hears about it. With DATABRICKS_NOT_AN_AGENT=1, databricks aitools auto-install enable prints "Automatic installation of Databricks AI tools is enabled." with no warning, even though the hook never runs. printAutoInstallSetting does print a yellow warning when DATABRICKS_AITOOLS_AUTO_INSTALL is the override. Could this become a non-due Reason in Decide, plus a matching line in printAutoInstallSetting and the auto-install help? Or could the baseline just set the existing DATABRICKS_AITOOLS_AUTO_INSTALL=false?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took the warning route, not the Decide reason. auto-install enable now prints a yellow line when DATABRICKS_NOT_AN_AGENT still stops the hook in this environment, the same as it does for DATABRICKS_AITOOLS_AUTO_INSTALL. The skip stays at the top of AutoInstall, before the state is read, so a stopped run writes nothing. Setting the existing override in the baseline would not be enough: this switch also turns off the footer and quickstart text that the baseline needs to see as human output. The not-an-agent acceptance script covers the enable output.

return nil
}
defer func() {
if r := recover(); r != nil {
log.Debugf(ctx, "auto-install: panic: %v", r)
Expand Down Expand Up @@ -278,7 +283,7 @@ func autoInstallOnce(ctx context.Context, skippedCommand bool) (os.Signal, bool)
version: version,
id: id,
arm: holdoutArm(in.Bucket),
interactive: cmdio.HasTerminal(ctx) && useragent.AgentProvider() == "",
interactive: cmdio.HasTerminal(ctx) && agent.Provider(ctx) == "",
now: in.Now,
}
if !reason.Due() {
Expand Down
18 changes: 18 additions & 0 deletions cmd/aitools/autoinstall_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/databricks/cli/libs/aitools/installer"
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/dbr"
"github.com/databricks/cli/libs/env"
"github.com/databricks/cli/libs/flags"
"github.com/databricks/cli/libs/process"
"github.com/databricks/cli/libs/telemetry"
Expand Down Expand Up @@ -592,6 +593,23 @@ func TestAutoInstallSkipsTheGateLookup(t *testing.T) {
assert.Equal(t, autoinstall.State{Consented: true, ID: "treatment-machine"}, state, "the version is not settled")
}

// With DATABRICKS_NOT_AN_AGENT set, a coding agent's run is not an agent's call: auto-install neither asks nor
// installs, and it does not look the gate up.
func TestAutoInstallSkipsUnderNotAnAgent(t *testing.T) {
home := setupAutoInstallHome(t, "", "CLAUDECODE", "1")
t.Cleanup(func() { gateOn = autoinstall.GateOn })
gateOn = func(context.Context, string) (bool, error) {
t.Error("the gate was looked up")
return true, nil
}
ctx := cmdio.MockDiscard(t.Context())
ctx = telemetry.WithNewLogger(ctx)
ctx = env.Set(ctx, "DATABRICKS_NOT_AN_AGENT", "1")
runAutoInstallHook(ctx)
assert.Empty(t, telemetry.BufferedEvents(ctx))
assert.NoDirExists(t, filepath.Join(home, ".cursor", "skills"))
}

// Root running in a user's home (sudo with HOME kept) leaves the home alone:
// it takes no lock, reads and writes no state, looks no gate up and installs
// nothing, so the user's own runs can still write there. The same run as the
Expand Down
28 changes: 16 additions & 12 deletions cmd/aitools/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/huh"
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/agent"
"github.com/databricks/cli/libs/aitools/agents"
"github.com/databricks/cli/libs/aitools/autoinstall"
"github.com/databricks/cli/libs/aitools/installer"
Expand Down Expand Up @@ -53,20 +54,22 @@ var errNoAgentsSelected = errors.New("at least one agent must be selected")
// variables:
// https://github.com/databricks/databricks-sdk-go/blob/main/useragent/agent.go
// An agent caller always gets the documented non-interactive behavior, as a
// run without a terminal does.
// run without a terminal does. DATABRICKS_NOT_AN_AGENT does not change this
// gate: a prompt that no one answers would block the agent, so it is a safety
// check, not a nudge.
func promptsSupported(ctx context.Context) bool {
return cmdio.IsPromptSupported(ctx) && useragent.AgentProvider() == ""
}

// noPromptsNote says that prompts were skipped because the caller is a coding
// agent. It names the detected agent by its --agents value when it has one.
func noPromptsNote() string {
provider := useragent.AgentProvider()
func noPromptsNote(ctx context.Context) string {
provider := agent.Provider(ctx)
detected := "a coding agent was"
if provider == "multiple" {
detected = "more than one coding agent was"
} else if agent := agents.AgentForProvider(provider); agent != nil {
detected = fmt.Sprintf("a coding agent (%s) was", agent.Name)
} else if a := agents.AgentForProvider(provider); a != nil {
detected = fmt.Sprintf("a coding agent (%s) was", a.Name)
}
return fmt.Sprintf("No prompts shown because %s detected.", detected)
}
Expand All @@ -75,10 +78,11 @@ func noPromptsNote() string {
// have run on a terminal: a person may be at it with an agent env var
// inherited from an agent session, and the note says why the prompt they
// expect is gone. Without a terminal nothing is printed: no caller is shown
// prompts there.
// prompts there. Under DATABRICKS_NOT_AN_AGENT the note is a nudge, so it is
// left out; the prompt is still skipped.
func logSkippedPromptNote(ctx context.Context) {
if cmdio.IsPromptSupported(ctx) && !promptsSupported(ctx) {
cmdio.LogString(ctx, noPromptsNote())
if cmdio.IsPromptSupported(ctx) && !promptsSupported(ctx) && !agent.NotAnAgent(ctx) {
cmdio.LogString(ctx, noPromptsNote(ctx))
}
}

Expand All @@ -87,8 +91,8 @@ func logSkippedPromptNote(ctx context.Context) {
// flags of `databricks aitools install` that would have replaced the skipped
// prompts. The command is named because the deprecated
// `experimental aitools skills install` alias does not accept these flags.
func agentCallerNote(missingFlags []string) string {
return fmt.Sprintf("%s Pass %s to databricks aitools install to choose what to install.", noPromptsNote(), strings.Join(missingFlags, " and "))
func agentCallerNote(ctx context.Context, missingFlags []string) string {
return fmt.Sprintf("%s Pass %s to databricks aitools install to choose what to install.", noPromptsNote(ctx), strings.Join(missingFlags, " and "))
}

// delivery is how the databricks tools are delivered to one agent.
Expand Down Expand Up @@ -322,7 +326,7 @@ Supported agents: ` + strings.Join(agents.SupportedNames(), ", "),
// A person may be at this terminal with an agent env var inherited
// from an agent session, so say why the prompts they would expect
// were skipped.
if !interactive && cmdio.IsPromptSupported(ctx) {
if !interactive && cmdio.IsPromptSupported(ctx) && !agent.NotAnAgent(ctx) {
var missing []string
if scope == "" {
missing = append(missing, "--scope")
Expand All @@ -331,7 +335,7 @@ Supported agents: ` + strings.Join(agents.SupportedNames(), ", "),
missing = append(missing, "--agents")
}
if len(missing) > 0 {
cmdio.LogString(ctx, agentCallerNote(missing))
cmdio.LogString(ctx, agentCallerNote(ctx, missing))
}
}

Expand Down
13 changes: 13 additions & 0 deletions cmd/aitools/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2129,6 +2129,19 @@ func TestInstallAgentCallerInPTYNeverPrompts(t *testing.T) {
assert.Equal(t, installer.ScopeGlobal, (*skills)[0].opts.Scope)
}

// DATABRICKS_NOT_AN_AGENT drops the note but not the skipped prompts: the agent in the pseudo-terminal still
// never gets a picker or a scope prompt.
func TestInstallAgentCallerInPTYNotAnAgentStillNeverPrompts(t *testing.T) {
_, _, scopePrompted := setupAgentCallerInstall(t, "CURSOR_AGENT", "1", "DATABRICKS_NOT_AN_AGENT", "1")

ctx, stderr := runInstallWithStderr(t, true)
assert.NotContains(t, stderr, "No prompts shown")
events := funnelEvents(ctx)
require.NotEmpty(t, events)
assert.False(t, events[0].Interactive)
assert.False(t, *scopePrompted)
}

func TestInstallAgentCallerNoteNamesOnlyMissingFlags(t *testing.T) {
setupAgentCallerInstall(t, "CURSOR_AGENT", "1")

Expand Down
6 changes: 3 additions & 3 deletions cmd/aitools/mcp_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Supported agents: ` + strings.Join(mcpAgentNames(), ", "),
}
runErr := runMcpAdd(ctx, cmd, f, jsonMode, out)
logMcpEvent(ctx, protos.AitoolsMcpEvent{
CallingAgent: callingAgentType(),
CallingAgent: callingAgentType(ctx),
Operation: protos.AitoolsMcpOperationAdd,
Servers: addServerResults(out.Servers),
})
Expand Down Expand Up @@ -1256,7 +1256,7 @@ func signInInstalled(ctx context.Context, errOut io.Writer, w *databricks.Worksp
if signedIn(ctx, w, plans[i].service.FullName) {
server.SignIn = &addSignInOutput{State: signInStateActive}
reportSignedIn(errOut, plans[i].service, req.profile, true)
logMcpEvent(ctx, signInEventOf(server.Service, signInStateActive, true, nil))
logMcpEvent(ctx, signInEventOf(ctx, server.Service, signInStateActive, true, nil))
continue
}
yes, err := promptSignInNow(server.Service)
Expand All @@ -1280,7 +1280,7 @@ func signInInstalled(ctx context.Context, errOut io.Writer, w *databricks.Worksp
eventState = state
}
server.SignIn = &addSignInOutput{State: state}
logMcpEvent(ctx, signInEventOf(server.Service, eventState, alreadySignedIn, err))
logMcpEvent(ctx, signInEventOf(ctx, server.Service, eventState, alreadySignedIn, err))
if err != nil {
server.SignIn.ErrorCategory = errorCategory(err)
server.SignIn.Error = err.Error()
Expand Down
8 changes: 4 additions & 4 deletions cmd/aitools/mcp_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func runMcpSignInCommand(cmd *cobra.Command, service string, action mcpSignInAct
runErr := runMcpSignIn(ctx, cmd.ErrOrStderr(), profileFlag(cmd), service, action, out)
// The host is set once the profile's binding has passed and its client exists, so a run that reached no server logs nothing.
if out.Host != "" {
logMcpEvent(ctx, signInEvent(operation, out, runErr))
logMcpEvent(ctx, signInEvent(ctx, operation, out, runErr))
}
if !jsonMode {
return runErr
Expand Down Expand Up @@ -173,12 +173,12 @@ func runMcpSignIn(ctx context.Context, errOut io.Writer, flagValue, service stri
}

// signInEvent is the SIGN_IN or SIGN_OUT event of one login or logout.
func signInEvent(operation protos.AitoolsMcpOperation, out *mcpSignInOutput, err error) protos.AitoolsMcpEvent {
func signInEvent(ctx context.Context, operation protos.AitoolsMcpOperation, out *mcpSignInOutput, err error) protos.AitoolsMcpEvent {
if operation == protos.AitoolsMcpOperationSignIn {
return signInEventOf(out.Service, out.State, out.alreadySignedIn, err)
return signInEventOf(ctx, out.Service, out.State, out.alreadySignedIn, err)
}
return protos.AitoolsMcpEvent{
CallingAgent: callingAgentType(),
CallingAgent: callingAgentType(ctx),
Operation: operation,
Servers: []protos.AitoolsMcpServerResult{signOutServerResult(out.Service, out.State, err)},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/aitools/mcp_remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func writeRemoveJSON(cmd *cobra.Command, out *removeOutput, runErr error) error
// output is written. A run that logged no event touched no server, so it has nothing to upload and sets no config.
func logRemoveEvent(ctx context.Context, out *removeOutput) {
if !logMcpEvent(ctx, protos.AitoolsMcpEvent{
CallingAgent: callingAgentType(),
CallingAgent: callingAgentType(ctx),
Operation: protos.AitoolsMcpOperationRemove,
Servers: out.results,
}) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/aitools/mcp_serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func runMcpServe(cmd *cobra.Command, f mcpServeFlags) error {
if err != nil {
return serveFailure(cmd, err, serveBindStatus)
}
agent := proxyAgentType(f.agent)
agent := proxyAgentType(cmd.Context(), f.agent)
var authorization string
cfg, entry, err := mcp.Bind(cmd.Context(), mcp.BindOptions{
Profile: profileName,
Expand Down
Loading
Loading