#4793: hooks: use configured model for slug generator
Cluster:
Model Configuration Enhancements
### Summary
`session-memory` can generate a human-friendly slug via an LLM call. When the provider/model is not explicitly specified, the slug generator may fall back to an Anthropic default, which is both noisy and can fail in deployments that only configure OpenAI.
### Changes
- Resolve the provider/model for slug generation from the configured defaults instead of relying on implicit fallback behavior.
- Add a regression test covering model resolution for the slug generator.
### Rationale
This avoids unintended Anthropic usage and prevents `No API key found for provider "anthropic"` errors during `/new` / `session-memory` runs when Anthropic is not configured.
### Testing
- `pnpm vitest run src/hooks/llm-slug-generator.test.ts`
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the session-memory slug generator to explicitly resolve the provider/model from the configured defaults (via `resolveDefaultModelForAgent`) and pass them into `runEmbeddedPiAgent`, avoiding implicit Anthropic fallback behavior. It also adds a regression test to ensure the slug generator honors the configured default model/provider (e.g., OpenAI) when Anthropic is not configured.
<h3>Confidence Score: 4/5</h3>
- This PR is likely safe to merge; changes are small and covered by a focused regression test.
- The change is localized to slug generation and uses an existing model-resolution helper that already encodes repo defaults and overrides. Main risk is if callers previously relied on implicit model/provider selection inside `runEmbeddedPiAgent`, but the new behavior aligns with configured defaults and is exercised by a new unit test.
- src/hooks/llm-slug-generator.test.ts (ensuring the config shape used in the test matches supported config schemas) and src/hooks/llm-slug-generator.ts (confirming the new explicit provider/model doesn’t conflict with agent overrides).
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#15574: fix(hooks): use configured model for llm slug generation (#15510)
by TsekaLuk · 2026-02-13
92.5%
#5945: fix: use configured model for slug generator (AI-assisted)
by HEDELKA · 2026-02-01
91.5%
#23286: fix: use configured model in llm-slug-generator instead of hardcoded …
by wsman · 2026-02-22
88.1%
#13401: fix: slug generator should use agent's primary model instead of har...
by pahud · 2026-02-10
87.6%
#12459: feat(session-memory): add model config for slug generation
by akari-musubi · 2026-02-09
87.0%
#9080: Fix: Use configured model for memory file slug generation
by vishaltandale00 · 2026-02-04
86.4%
#18867: fix: route slug generator LLM call through configured provider
by Celegormhenry · 2026-02-17
85.1%
#7981: fix(runner): use configured primary model as fallback default
by PiyushDuggal-source · 2026-02-03
80.4%
#16838: fix: include configured fallbacks in model allowlist
by taw0002 · 2026-02-15
78.7%
#21735: fix(hooks): pass configured model to slug generator (#21650)
by lailoo · 2026-02-20
78.4%