Skip to content

[Code Quality] Type *TimeoutMinutes int constants as time.Duration #50004

Description

@github-actions

Description

typist analysis (discussion #49984) flagged a recurring "Minutes-suffix-as-unit" anti-pattern: several constants encode their time unit only in the name/comment, not the type, risking unit-mismatch bugs.

Suggested Changes

  • workflowCompletionWaitTimeoutMinutes = 6 * 60 in pkg/cli/run_workflow_execution.go:26 — passed as a bare int into a timeoutMinutes int parameter of WaitForWorkflowCompletion (used at run_workflow_execution.go:470), while a neighboring constant in the same file already correctly uses time.Duration.
  • Five *TimeoutMinutes constants in pkg/cli/mcp_tools_privileged.go:21,28,34,40,44
  • defaultSafeOutputsTimeoutMinutes = 45 in pkg/workflow/compiler_safe_outputs_job.go:539

Convert each to a time.Duration constant (e.g. 6 * time.Hour, 1 * time.Minute) and update the corresponding parameter/field types and call sites.

Files Affected

  • pkg/cli/run_workflow_execution.go
  • pkg/cli/mcp_tools_privileged.go
  • pkg/workflow/compiler_safe_outputs_job.go

Success Criteria

  • All *TimeoutMinutes constants replaced with time.Duration typed constants
  • No remaining bare-int minute values used as durations at these call sites
  • Existing tests pass

Source

Extracted from Typist - Go Type Consistency Analysis discussion #49984

Priority

Medium - closes off a unit-mismatch bug class. Estimated effort: 1-2 hours.

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · auto · 88.4 AIC · ⌖ 4.01 AIC · ⊞ 10.3K · ◷

  • expires on Aug 4, 2026, 5:45 AM UTC-08:00

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions