Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/cli/mcp_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import (

var mcpInspectLog = logger.New("cli:mcp_inspect")

// mcpScriptsServerShutdownDelay gives the embedded mcp-scripts server a brief window to stop gracefully.
const mcpScriptsServerShutdownDelay = 500 * time.Millisecond

// InspectWorkflowMCP inspects MCP servers used by a workflow and lists available tools, resources, and roots
func InspectWorkflowMCP(workflowFile string, serverFilter string, toolFilter string, verbose bool, useActionsSecrets bool) error {
mcpInspectLog.Printf("Inspecting workflow MCP: workflow=%s, serverFilter=%s, toolFilter=%s",
Expand Down Expand Up @@ -131,7 +134,7 @@ func InspectWorkflowMCP(workflowFile string, serverFilter string, toolFilter str
fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Failed to send interrupt signal: %v", err)))
}
// Wait a moment for graceful shutdown
time.Sleep(500 * time.Millisecond)
time.Sleep(mcpScriptsServerShutdownDelay)
// Attempt force kill (may fail if process already exited gracefully, which is fine)
_ = mcpScriptsServerCmd.Process.Kill()
}
Expand Down
11 changes: 9 additions & 2 deletions pkg/cli/mcp_inspect_inspector.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ import (

var mcpInspectorLog = logger.New("cli:mcp_inspect_inspector")

const (
// mcpStdioServerStartupDelay gives stdio MCP servers time to start accepting connections.
mcpStdioServerStartupDelay = 2 * time.Second
// mcpProcessCleanupDelay spaces cleanup signals so each MCP process can exit cleanly.
mcpProcessCleanupDelay = 100 * time.Millisecond
)

// spawnMCPInspector launches the official @modelcontextprotocol/inspector tool
// and spawns any stdio MCP servers beforehand
func spawnMCPInspector(workflowFile string, serverFilter string, verbose bool) error {
Expand Down Expand Up @@ -154,7 +161,7 @@ func spawnMCPInspector(workflowFile string, serverFilter string, verbose bool) e
}

// Give servers a moment to start up
time.Sleep(2 * time.Second)
time.Sleep(mcpStdioServerStartupDelay)
fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("All stdio servers started successfully"))
}

Expand Down Expand Up @@ -198,7 +205,7 @@ func spawnMCPInspector(workflowFile string, serverFilter string, verbose bool) e
}
// Give each process a chance to clean up
if i < len(serverProcesses)-1 {
time.Sleep(100 * time.Millisecond)
time.Sleep(mcpProcessCleanupDelay)
}
}
// Wait for all background goroutines to finish (with timeout)
Expand Down
4 changes: 3 additions & 1 deletion pkg/cli/mcp_inspect_mcp_scripts_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const (
// Port range for mcp-scripts HTTP server
mcpScriptsStartPort = 3000
mcpScriptsPortRange = 10
// mcpScriptsServerStartupDelay paces readiness checks while the mcp-scripts server boots.
mcpScriptsServerStartupDelay = 200 * time.Millisecond
)
Comment on lines 21 to 25

// findAvailablePort finds an available port starting from the given port
Expand Down Expand Up @@ -59,7 +61,7 @@ func waitForServerReady(port int, timeout time.Duration, verbose bool) bool {
}
return true
}
time.Sleep(200 * time.Millisecond)
time.Sleep(mcpScriptsServerStartupDelay)
}

mcpInspectLog.Printf("Server did not become ready within timeout")
Expand Down
5 changes: 4 additions & 1 deletion pkg/cli/run_workflow_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ var executionLog = logger.New("cli:run_workflow_execution")
// workflowCompletionWaitTimeoutMinutes matches the GitHub Actions maximum job runtime.
const workflowCompletionWaitTimeoutMinutes = 6 * 60

// betweenWorkflowsDelay paces sequential workflow triggers to avoid overwhelming the GitHub API.
const betweenWorkflowsDelay = 1 * time.Second

// RunOptions contains all configuration options for running workflows
type RunOptions struct {
Enable bool // Enable the workflow if it's disabled
Expand Down Expand Up @@ -568,7 +571,7 @@ func RunWorkflowsOnGitHub(ctx context.Context, workflowNames []string, opts RunO

// Add a small delay between workflows to avoid overwhelming GitHub API
if i < len(workflowNames)-1 {
time.Sleep(1 * time.Second)
time.Sleep(betweenWorkflowsDelay)
}
}

Expand Down
5 changes: 4 additions & 1 deletion pkg/cli/trial_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import (

var trialRepoLog = logger.New("cli:trial_repository")

// trialRepoInitDelay gives GitHub time to finish initializing a newly created repository.
const trialRepoInitDelay = 2 * time.Second

// checkoutActionPattern matches actions/checkout step lines with leading indentation
var checkoutActionPattern = regexp.MustCompile(`^(\s*)(uses: actions/checkout@[^\s]*)(.*)$`)

Expand Down Expand Up @@ -150,7 +153,7 @@ func ensureTrialRepository(repoSlug string, cloneRepoSlug string, forceDeleteHos
}

// Give GitHub a moment to fully initialize the repository
time.Sleep(2 * time.Second)
time.Sleep(trialRepoInitDelay)

return nil
}
Expand Down