Skip to content

[Code Quality] Migrate deprecated timeout constants to time.Duration types #11995

@github-actions

Description

@github-actions

Description

The codebase contains deprecated integer timeout constants that should be migrated to time.Duration types for better type safety and consistency.

Current State

Deprecated constants in pkg/constants/constants.go:

  • DefaultAgenticWorkflowTimeoutMinutes (int)
  • DefaultToolTimeoutSeconds (int)
  • DefaultMCPStartupTimeoutSeconds (int)

Modern replacements already exist:

  • DefaultAgenticWorkflowTimeout (time.Duration)
  • DefaultToolTimeout (time.Duration)
  • DefaultMCPStartupTimeout (time.Duration)

Affected Files

Still using deprecated constants:

  • pkg/workflow/tools.go:145
  • pkg/workflow/copilot_engine_execution.go:503
  • pkg/workflow/claude_engine.go:423-424,429-430,519
  • pkg/workflow/compiler_timeout_default_test.go (multiple lines)
  • pkg/workflow/mcp_renderer.go:367-368,374-375

Suggested Changes

  1. Update call sites to use time.Duration constants:

    // Before:
    timeout := constants.DefaultAgenticWorkflowTimeoutMinutes
    
    // After:
    timeout := int(constants.DefaultAgenticWorkflowTimeout / time.Minute)
  2. Remove deprecated constants from pkg/constants/constants.go (lines 407-419)

  3. Update tests in pkg/constants/constants_test.go to remove deprecated constant tests

Success Criteria

  • ✅ All 6+ call sites migrated to use time.Duration constants
  • ✅ Deprecated constants removed from pkg/constants/constants.go
  • ✅ All tests pass (make test-unit)
  • ✅ Code formatted and linted (make fmt && make lint)

Benefits

  • Type safety: Using time.Duration provides compile-time type checking
  • Consistency: Aligns with modern Go best practices
  • Maintainability: Reduces technical debt
  • Clarity: Makes duration units explicit (no confusion about seconds vs minutes)

Source

Extracted from codebase analysis - TODO comment at pkg/constants/constants.go:407

Priority

Medium - Technical debt cleanup that improves code quality

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 10, 2026, 5:12 AM UTC

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions