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
- Add
type LLMProvider string in pkg/workflow/llm_provider.go
- Type the three constants:
LLMProviderGitHub LLMProvider = "github" etc.
- Update
EngineConfig.LLMProvider field from string to LLMProvider
- Update
ResolveLLMProvider(...) string interface method to return LLMProvider
- Update all engine implementations (claude, codex, copilot, pi engines)
- 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 · ◷
Description
The LLM provider identifiers (
LLMProviderGitHub,LLMProviderAnthropic,LLMProviderOpenAI) inpkg/workflow/llm_provider.goare declared as plainstringconstants. This closed enum is threaded as a barestringthrough theResolveLLMProvider(...) stringinterface method, its 5 engine implementations, theEngineConfig.LLMProvider stringfield, and fourswitch normalizeLLMProvider(...)sites — allowing arbitrary strings to be passed without compile-time safety.Suggested Changes
type LLMProvider stringinpkg/workflow/llm_provider.goLLMProviderGitHub LLMProvider = "github"etc.EngineConfig.LLMProviderfield fromstringtoLLMProviderResolveLLMProvider(...) stringinterface method to returnLLMProvidernormalizeLLMProviderreturn typeFiles 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)Success Criteria
type LLMProvider stringdefinedLLMProvidertype (no implicitstringconversions)make fmtgreenSource
Extracted from [typist] 🔤 Typist — Go Type Consistency Analysis #47070
Priority
High — prevents arbitrary provider strings, improves contract clarity across 5 engine implementations