Skip to content

Self-hosted workflows for coding-agent delivery. Orchestrate CodeBuddy, Codex and Claude Code with scripts and human approval gates. Includes Local workflows for coding assistants.

refactor(runner): replace hasCredentialBinding with slices.Contains (#294)

fx-kurumid1100535b427
diff --git a/internal/runner/daemon.go b/internal/runner/daemon.go
index a4cf0d44..9c6125df 100644
--- a/internal/runner/daemon.go
+++ b/internal/runner/daemon.go
@@ -11,6 +11,7 @@ import (
"path"
"path/filepath"
goruntime "runtime"
+ "slices"
"strconv"
"strings"
"sync"
@@ -883,7 +884,7 @@ func (d *Daemon) executeInvocation(ctx context.Context, task domain.RunnerTask)
for key, value := range credentialEnv {
commandEnv[key] = value
}
- if hasCredentialBinding(prepared.Command.CredentialBindings, runtime.BindGit) {
+ if slices.Contains(prepared.Command.CredentialBindings, runtime.BindGit) {
gitEnv, gitErr := runtime.GitEnvironment(sandbox, workspace, invocationGitToken(inv))
if gitErr != nil {
return execResult{status: domain.RunnerTaskFailed, errMsg: fmt.Sprintf("prepare git credentials: %v", gitErr)}, nil
@@ -897,7 +898,7 @@ func (d *Daemon) executeInvocation(ctx context.Context, task domain.RunnerTask)
commandEnv[key] = value
}
}
- if hasCredentialBinding(prepared.Command.CredentialBindings, runtime.BindMCP) {
+ if slices.Contains(prepared.Command.CredentialBindings, runtime.BindMCP) {
servers := inv.MCPCallServers
if len(servers) == 0 {
servers = boundAssets.MCPServers
@@ -1100,15 +1101,6 @@ func invocationGitToken(inv *domain.RunnerInvocation) string {
return ""
}
-func hasCredentialBinding(bindings []runtime.CredentialBinding, want runtime.CredentialBinding) bool {
- for _, binding := range bindings {
- if binding == want {
- return true
- }
- }
- return false
-}
-
// checkoutInvocationRepositories checks out every repository the invocation
// carries: each into its Dir under the task workspace. Empty Dir is only
// kept for persisted legacy invocations that already checked out at the
diff --git a/internal/runner/protocol_cases_test.go b/internal/runner/protocol_cases_test.go
index 9db0fea9..91fffb99 100644
--- a/internal/runner/protocol_cases_test.go
+++ b/internal/runner/protocol_cases_test.go
@@ -213,9 +213,6 @@ func TestRunnerCredentialArtifactAndRepositoryHelpers(t *testing.T) {
t.Fatalf("binding=%v err=%v wantErr=%v", tc.binding, err, tc.wantErr)
}
}
- if !hasCredentialBinding([]flowruntime.CredentialBinding{flowruntime.BindGit}, flowruntime.BindGit) || hasCredentialBinding(nil, flowruntime.BindGit) {
- t.Fatal("binding lookup")
- }
}
func TestWorkspacePayloadMarshalFailure(t *testing.T) {