Skip to content

[Code Quality] Add named type LLMProvider string in pkg/workflow/llm_provider.go #47172

Description

@github-actions

Description

The LLM provider identifiers (LLMProviderGitHub, LLMProviderAnthropic, LLMProviderOpenAI) in pkg/workflow/llm_provider.go are declared as plain string constants. This closed enum is threaded as a bare string through the ResolveLLMProvider(...) string interface method, its 5 engine implementations, the EngineConfig.LLMProvider string field, and four switch normalizeLLMProvider(...) sites — allowing arbitrary strings to be passed without compile-time safety.

Suggested Changes

  1. Add type LLMProvider string in pkg/workflow/llm_provider.go
  2. Type the three constants: LLMProviderGitHub LLMProvider = "github" etc.
  3. Update EngineConfig.LLMProvider field from string to LLMProvider
  4. Update ResolveLLMProvider(...) string interface method to return LLMProvider
  5. Update all engine implementations (claude, codex, copilot, pi engines)
  6. Update normalizeLLMProvider return type

Files Affected

  • pkg/workflow/llm_provider.go (add type, re-type constants)
  • pkg/workflow/engine.go (EngineConfig.LLMProvider field)
  • pkg/workflow/agentic_engine.go (interface method signature)
  • Engine implementation files (claude/codex/copilot/pi engines)

Success Criteria

  • type LLMProvider string defined
  • All call sites use LLMProvider type (no implicit string conversions)
  • All tests pass
  • make fmt green

Source

Extracted from [typist] 🔤 Typist — Go Type Consistency Analysis #47070

Priority

High — prevents arbitrary provider strings, improves contract clarity across 5 engine implementations

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · sonnet46 36.2 AIC · ⌖ 8.3 AIC · ⊞ 7.1K ·

  • expires on Jul 22, 2026, 5:16 PM UTC-08:00

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions