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.
JavaScript agent-orchestrationagentic-workflowai-agentsai-codingclaude-codecode-reviewcodebuddycodexcoding-agentscursordeveloper-toolshuman-on-the-loopllmmcpmulti-agentsdlcself-hostedsopworkflow-automationworkflow-engine
【架构优化】runs/dispatch 复用 repositoryRunContext,删除两处重复的 RepositoryContext 字段拷贝 (#676) (#678)
fx-kurumif5c596343459
diff --git a/internal/httpapi/dispatch.go b/internal/httpapi/dispatch.goindex 040a767e..f9e150db 100644--- a/internal/httpapi/dispatch.go+++ b/internal/httpapi/dispatch.go@@ -116,7 +116,7 @@ func dispatchIssue(d *deps, req dispatchRequest) (domain.Task, error) {}var repositories []domain.RepositoryContextfor _, repo := range boundRepositories {- rc := domain.RepositoryContext{RepositoryID: repo.ID, Provider: repo.Provider, Name: repo.Name, GongfengProjectID: repo.GongfengProjectID, WebURL: repo.WebURL, CloneURL: repo.CloneURL, BaseBranch: repo.DefaultBranch, LocalPath: repo.LocalPath, PipelineProjectID: repo.PipelineProjectID, PipelineDefID: repo.PipelineDefID, PipelineURLPattern: repo.PipelineURLPattern, DefaultBranch: repo.DefaultBranch}+ rc := repositoryRunContext(repo)if selectedWorkBranch := branchSelection.WorkBranchForRepository(repo.ID); selectedWorkBranch != "" {rc.WorkBranch = selectedWorkBranchrc.RequireExistingWorkBranch = truediff --git a/internal/httpapi/repository_run_context_test.go b/internal/httpapi/repository_run_context_test.gonew file mode 100644index 00000000..ce24c192--- /dev/null+++ b/internal/httpapi/repository_run_context_test.go@@ -0,0 +1,26 @@+package httpapi++import (+ "reflect"+ "testing"++ "agentflow/internal/domain"+)++func TestRepositoryRunContextCopiesRunFields(t *testing.T) {+ got := repositoryRunContext(domain.Repository{+ ID: "repo-1", ProjectID: "project-1", Provider: "github", Name: "LoopForge",+ GongfengProjectID: "123", WebURL: "https://example.com/web", CloneURL: "https://example.com/web.git",+ DefaultBranch: "main", LocalPath: "/srv/repo", GitToken: "secret",+ PipelineProjectID: 7, PipelineDefID: 9, PipelineURLPattern: "https://ci/{id}", IntegrateBranch: "integrate",+ })+ want := domain.RepositoryContext{+ RepositoryID: "repo-1", Provider: "github", Name: "LoopForge",+ GongfengProjectID: "123", WebURL: "https://example.com/web", CloneURL: "https://example.com/web.git",+ BaseBranch: "main", DefaultBranch: "main", LocalPath: "/srv/repo",+ PipelineProjectID: 7, PipelineDefID: 9, PipelineURLPattern: "https://ci/{id}",+ }+ if !reflect.DeepEqual(got, want) {+ t.Fatalf("repositoryRunContext() = %#v, want %#v", got, want)+ }+}diff --git a/internal/httpapi/runs.go b/internal/httpapi/runs.goindex 7e58bddb..0b4a757b 100644--- a/internal/httpapi/runs.go+++ b/internal/httpapi/runs.go@@ -132,12 +132,7 @@ func (h *runsHandlers) runs(c *gin.Context) {c.JSON(http.StatusConflict, map[string]string{"error": "项目默认代码仓库无效,请重新绑定", "code": "repository_required"})return}- repositories = []domain.RepositoryContext{{- RepositoryID: repoDef.ID, Provider: repoDef.Provider, Name: repoDef.Name,- GongfengProjectID: repoDef.GongfengProjectID, WebURL: repoDef.WebURL, CloneURL: repoDef.CloneURL,- BaseBranch: repoDef.DefaultBranch, DefaultBranch: repoDef.DefaultBranch, LocalPath: repoDef.LocalPath,- PipelineProjectID: repoDef.PipelineProjectID, PipelineDefID: repoDef.PipelineDefID, PipelineURLPattern: repoDef.PipelineURLPattern,- }}+ repositories = []domain.RepositoryContext{repositoryRunContext(repoDef)}}v, err := h.engine.StartWithRepositoriesContext(req.WorkflowID, req.Input, repositories, domain.TelemetryContext{ProjectID: req.ProjectID, ResponsibleUserID: responsibleUserID})if err != nil {