From 2760551f6b9a28fc761e474f802683134f498e7c Mon Sep 17 00:00:00 2001 From: Jeff Haynie Date: Wed, 11 Jun 2025 17:33:38 -0500 Subject: [PATCH 1/2] More normalized Python project naming --- cmd/agent.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/agent.go b/cmd/agent.go index 99e1094e..df5410e2 100644 --- a/cmd/agent.go +++ b/cmd/agent.go @@ -395,7 +395,7 @@ func reconcileAgentList(logger logger.Logger, cmd *cobra.Command, apiUrl string, fileAgents := make(map[string]project.AgentConfig) fileAgentsByID := make(map[string]project.AgentConfig) for _, agent := range theproject.Project.Agents { - key := normalAgentName(agent.Name, theproject.Project.IsPython()) + agent.Name + key := normalAgentName(agent.Name, theproject.Project.IsPython()) fileAgents[key] = agent fileAgentsByID[agent.ID] = agent } @@ -407,18 +407,17 @@ func reconcileAgentList(logger logger.Logger, cmd *cobra.Command, apiUrl string, state := make(map[string]agentListState) for _, agent := range remoteAgents { normalizedName := normalAgentName(agent.Name, theproject.Project.IsPython()) - key := normalizedName + agent.Name filename1 := filepath.Join(agentSrcDir, normalizedName, agentFilename) filename2 := filepath.Join(agentSrcDir, agent.Name, agentFilename) if util.Exists(filename1) { - state[key] = agentListState{ + state[normalizedName] = agentListState{ Agent: &agent, Filename: filename1, FoundLocal: true, FoundRemote: true, } } else if util.Exists(filename2) { - state[key] = agentListState{ + state[normalizedName] = agentListState{ Agent: &agent, Filename: filename2, FoundLocal: true, @@ -433,7 +432,7 @@ func reconcileAgentList(logger logger.Logger, cmd *cobra.Command, apiUrl string, for _, filename := range localAgents { agentName := filepath.Base(filepath.Dir(filename)) normalizedName := normalAgentName(agentName, theproject.Project.IsPython()) - key := normalizedName + agentName + key := normalizedName // var found bool // for _, agent := range remoteAgents { // if localAgent, ok := fileAgentsByID[agent.ID]; ok { From d20d287bb88d422bfa99df7844d6e7f2c604b3b4 Mon Sep 17 00:00:00 2001 From: Jeff Haynie Date: Wed, 11 Jun 2025 18:21:35 -0500 Subject: [PATCH 2/2] Update cmd/agent.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- cmd/agent.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/agent.go b/cmd/agent.go index df5410e2..a4137a78 100644 --- a/cmd/agent.go +++ b/cmd/agent.go @@ -395,10 +395,16 @@ func reconcileAgentList(logger logger.Logger, cmd *cobra.Command, apiUrl string, fileAgents := make(map[string]project.AgentConfig) fileAgentsByID := make(map[string]project.AgentConfig) for _, agent := range theproject.Project.Agents { - key := normalAgentName(agent.Name, theproject.Project.IsPython()) - fileAgents[key] = agent - fileAgentsByID[agent.ID] = agent - } + key := normalAgentName(agent.Name, theproject.Project.IsPython()) + if existing, ok := fileAgents[key]; ok { + logger.Warn( + "agent name collision: %q and %q normalize to %q; keeping first entry", + existing.Name, agent.Name, key, + ) + continue + } + fileAgents[key] = agent + fileAgentsByID[agent.ID] = agent agentFilename := rules.Filename agentSrcDir := filepath.Join(theproject.Dir, theproject.Project.Bundler.AgentConfig.Dir)