From 21599d7f8fb9d724ac57d1a0156d9ef930e87500 Mon Sep 17 00:00:00 2001 From: Jeff Haynie Date: Tue, 10 Jun 2025 20:50:30 -0500 Subject: [PATCH 1/4] Unregister dev mode session on shutdown --- internal/dev/server.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/dev/server.go b/internal/dev/server.go index 006b05fd..4afe71ae 100644 --- a/internal/dev/server.go +++ b/internal/dev/server.go @@ -107,6 +107,7 @@ func (s *Server) Close() error { s.logger.Debug("closing connection") s.once.Do(func() { s.cancel() + s.closeConnection() s.wg.Wait() if s.conn != nil { s.conn.Close() @@ -119,6 +120,12 @@ func (s *Server) Close() error { return nil } +func (s *Server) closeConnection() { + if err := s.apiclient.Do("DELETE", "/cli/devmode/"+s.Project.Project.ProjectId+"/"+s.ID, nil, nil); err != nil { + s.logger.Error("failed to send close connection: %s", err) + } +} + func (s *Server) refreshConnection() error { var resp ConnectionResponse if err := s.apiclient.Do("GET", "/cli/devmode/"+s.Project.Project.ProjectId+"/"+s.ID, nil, &resp); err != nil { @@ -660,7 +667,7 @@ func New(args ServerArgs) (*Server, error) { tracer: tracer, version: args.Version, port: args.Port, - apiclient: util.NewAPIClient(ctx, args.Logger, args.APIURL, args.APIKey), + apiclient: util.NewAPIClient(context.WithoutCancel(ctx), args.Logger, args.APIURL, args.APIKey), connected: make(chan error, 1), } From 694abdbee788c9aa1702f2535d7e9358c807044b Mon Sep 17 00:00:00 2001 From: Jeff Haynie Date: Tue, 10 Jun 2025 21:43:13 -0500 Subject: [PATCH 2/4] small cleanup for newer urls --- internal/util/api.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/util/api.go b/internal/util/api.go index 8b8279f9..3ffc54e6 100644 --- a/internal/util/api.go +++ b/internal/util/api.go @@ -266,16 +266,16 @@ func GetURLs(logger logger.Logger) (string, string, string) { if apiUrl == "https://api.agentuity.com" && appUrl != "https://app.agentuity.com" { logger.Debug("switching app url to production since the api url is production") appUrl = "https://app.agentuity.com" - } else if apiUrl == "https://api.agentuity.dev" && appUrl == "https://app.agentuity.com" { + } else if apiUrl == "https://api.agentuity.io" && appUrl == "https://app.agentuity.com" { logger.Debug("switching app url to dev since the api url is dev") - appUrl = "http://127.0.0.1:3000" + appUrl = "https://app.agentuity.io" } if apiUrl == "https://api.agentuity.com" && transportUrl != "https://agentuity.api" { logger.Debug("switching transport url to production since the api url is production") transportUrl = "https://agentuity.ai" - } else if apiUrl == "https://api.agentuity.dev" && transportUrl == "https://agentuity.ai" { + } else if apiUrl == "https://api.agentuity.io" && transportUrl == "https://agentuity.ai" { logger.Debug("switching transport url to dev since the api url is dev") - transportUrl = "http://127.0.0.1:3939" + transportUrl = "https://ai.agentuity.io" } return TransformUrl(apiUrl), TransformUrl(appUrl), TransformUrl(transportUrl) } From 842997cc351c9bc2d5c15705ee647d8b6cf09ea4 Mon Sep 17 00:00:00 2001 From: Jeff Haynie Date: Tue, 10 Jun 2025 21:44:54 -0500 Subject: [PATCH 3/4] small tweak --- internal/dev/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/dev/server.go b/internal/dev/server.go index 4afe71ae..3e2c7c39 100644 --- a/internal/dev/server.go +++ b/internal/dev/server.go @@ -106,8 +106,8 @@ type ConnectionResponse struct { func (s *Server) Close() error { s.logger.Debug("closing connection") s.once.Do(func() { - s.cancel() s.closeConnection() + s.cancel() s.wg.Wait() if s.conn != nil { s.conn.Close() From 6876ec82aec2785ac41b04cf3bed553e090aeb10 Mon Sep 17 00:00:00 2001 From: Jeff Haynie Date: Tue, 10 Jun 2025 22:18:31 -0500 Subject: [PATCH 4/4] good catch, rabbit --- internal/util/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/util/api.go b/internal/util/api.go index 3ffc54e6..73d789be 100644 --- a/internal/util/api.go +++ b/internal/util/api.go @@ -270,7 +270,7 @@ func GetURLs(logger logger.Logger) (string, string, string) { logger.Debug("switching app url to dev since the api url is dev") appUrl = "https://app.agentuity.io" } - if apiUrl == "https://api.agentuity.com" && transportUrl != "https://agentuity.api" { + if apiUrl == "https://api.agentuity.com" && transportUrl != "https://agentuity.ai" { logger.Debug("switching transport url to production since the api url is production") transportUrl = "https://agentuity.ai" } else if apiUrl == "https://api.agentuity.io" && transportUrl == "https://agentuity.ai" {