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
refactor(domain): reuse TerminalRunStatus in computeRunTiming (#464)
fx-kurumi0e72ab14dd0d
diff --git a/internal/domain/run_timing.go b/internal/domain/run_timing.goindex a13f950b..0e384ea0 100644--- a/internal/domain/run_timing.go+++ b/internal/domain/run_timing.go@@ -41,10 +41,6 @@ var runIntervalClosers = map[string]bool{var runTerminalEvents = map[string]bool{"run.failed": true, "run.cancelled": true, "run.succeeded": true}-func runTerminal(status string) bool {- return status == "succeeded" || status == "failed" || status == "cancelled"-}-// ComputeRunTiming derives timing from the run event log. Node rows only keep// the latest attempt, and approval waits leave FinishedAt at the decision// time, so the event log is the only source that covers every attempt. Runs@@ -151,7 +147,7 @@ func computeRunTiming(run Run, events []RunEvent, now time.Time) (RunTiming, []R// open, otherwise the terminal run event, falling back to the last event, the// run's UpdatedAt, and finally now.func runTimingEnd(run Run, terminalAt, lastEvent, now time.Time) time.Time {- if !runTerminal(run.Status) {+ if !TerminalRunStatus(run.Status) {return now}for _, at := range []time.Time{terminalAt, lastEvent, run.UpdatedAt} {diff --git a/internal/domain/run_timing_test.go b/internal/domain/run_timing_test.goindex 63ab9ca5..78d7bd59 100644--- a/internal/domain/run_timing_test.go+++ b/internal/domain/run_timing_test.go@@ -119,3 +119,27 @@ func TestRunTimingFallsBackToNodeRows(t *testing.T) {t.Fatalf("unexpected timing %+v", got)}}++func TestRunTimingWallClockStopsOnlyForTerminalRuns(t *testing.T) {+ t0 := time.Date(2026, 9, 21, 11, 0, 0, 0, time.UTC)+ now := t0.Add(time.Hour)+ for _, status := range []string{"succeeded", "failed", "cancelled"} {+ events := timingEvents(t0,+ time.Minute, "a", "node.started",+ 4*time.Minute, "a", "node.succeeded",+ 5*time.Minute, "", "run."+status)+ got := ComputeRunTiming(Run{Status: status, CreatedAt: t0}, events, now)+ if got.WallMs != (5*time.Minute).Milliseconds() || got.ExecutionMs != (3*time.Minute).Milliseconds() {+ t.Fatalf("%s run timing %+v", status, got)+ }+ }+ for _, status := range []string{"queued", "running", "waiting"} {+ events := timingEvents(t0,+ time.Minute, "a", "node.started",+ 4*time.Minute, "a", "node.succeeded")+ got := ComputeRunTiming(Run{Status: status, CreatedAt: t0}, events, now)+ if got.WallMs != time.Hour.Milliseconds() {+ t.Fatalf("%s run should accrue wall clock until now: %+v", status, got)+ }+ }+}