#14464: fix(hooks): use configured primary model for slug generation (#14272)
stale
size: S
Cluster:
Model Configuration Enhancements
## Summary
Fixes #14272
## Problem
`generateSlugViaLLM` in `src/hooks/llm-slug-generator.ts` hardcodes `anthropic` as the provider and `claude-haiku` as the model for slug generation. Users who configure a different primary model (e.g. `openai/gpt-4.1-mini`) still get Anthropic API calls, which fail if they don't have an Anthropic API key.
## Fix
Use `resolveConfiguredModelRef()` to read the user's configured primary model and pass its `provider`/`model` to `runEmbeddedPiAgent`. Falls back to the original Anthropic defaults when no model is configured.
## Reproduction & Verification
### Before fix (main branch) — Bug confirmed:
- `src/hooks/llm-slug-generator.ts` hardcodes `provider: "anthropic"` and `modelId: "claude-haiku"` — no test file exists on main.
- Users with non-Anthropic configs get `FailoverError` when session-memory hook tries to generate slugs.
### After fix — All verified:
```
✓ passes configured primary model to runEmbeddedPiAgent (#14272)
✓ falls back to default Anthropic model when no primary is configured
✓ returns cleaned slug from LLM response
✓ returns null when LLM returns no payloads
✓ returns null when LLM throws
5 tests pass (pnpm vitest run src/hooks/llm-slug-generator.test.ts)
```
## Testing
- ✅ 5 tests pass (`pnpm vitest run src/hooks/llm-slug-generator.test.ts`)
- ✅ Lint passes
Most Similar PRs
#21735: fix(hooks): pass configured model to slug generator (#21650)
by lailoo · 2026-02-20
85.6%
#15574: fix(hooks): use configured model for llm slug generation (#15510)
by TsekaLuk · 2026-02-13
83.5%
#23286: fix: use configured model in llm-slug-generator instead of hardcoded …
by wsman · 2026-02-22
81.1%
#5945: fix: use configured model for slug generator (AI-assisted)
by HEDELKA · 2026-02-01
79.0%
#9080: Fix: Use configured model for memory file slug generation
by vishaltandale00 · 2026-02-04
78.8%
#18867: fix: route slug generator LLM call through configured provider
by Celegormhenry · 2026-02-17
78.6%
#4793: hooks: use configured model for slug generator
by yoyooyooo · 2026-01-30
78.4%
#13401: fix: slug generator should use agent's primary model instead of har...
by pahud · 2026-02-10
76.2%
#12459: feat(session-memory): add model config for slug generation
by akari-musubi · 2026-02-09
72.8%
#16838: fix: include configured fallbacks in model allowlist
by taw0002 · 2026-02-15
67.6%