From f33f6514f23888dffeb3c4d6fdd265fd7ea2df4e Mon Sep 17 00:00:00 2001 From: Donnie Adams Date: Mon, 6 Jan 2025 21:11:02 -0500 Subject: [PATCH] fix: stop show credential threads to users The threads used to authorize agents and workflows should not be shown to users. This change ensures that is the case. Signed-off-by: Donnie Adams --- pkg/api/handlers/agent.go | 2 ++ pkg/controller/handlers/toolinfo/toolinfo.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/api/handlers/agent.go b/pkg/api/handlers/agent.go index 4d0849e34..75dde0d6a 100644 --- a/pkg/api/handlers/agent.go +++ b/pkg/api/handlers/agent.go @@ -953,6 +953,8 @@ func runAuthForAgent(ctx context.Context, c kclient.WithWatch, invoker *invoke.I agent.Spec.Manifest.AvailableThreadTools = nil agent.Spec.Manifest.DefaultThreadTools = nil agent.Spec.Credentials = credentials + agent.Spec.CredentialContextID = agent.Name + agent.Name = "" return invoker.Agent(ctx, c, agent, "", invoke.Options{ Synchronous: true, diff --git a/pkg/controller/handlers/toolinfo/toolinfo.go b/pkg/controller/handlers/toolinfo/toolinfo.go index ce52610e4..74d5396a3 100644 --- a/pkg/controller/handlers/toolinfo/toolinfo.go +++ b/pkg/controller/handlers/toolinfo/toolinfo.go @@ -35,7 +35,7 @@ func (h *Handler) SetToolInfoStatus(req router.Request, resp router.Response) (e // Get all the credentials that exist in the expected context. creds, err := h.gptscript.ListCredentials(req.Ctx, gptscript.ListCredentialsOptions{ - CredentialContexts: []string{req.Name}, + CredentialContexts: []string{req.Name, req.Namespace}, }) if err != nil { return err