#9080: Fix: Use configured model for memory file slug generation
stale
Cluster:
Model Configuration Enhancements
Fixes #9074
## Problem
When using only local models (e.g., via LM Studio), memory files created from compaction all get the slug `http-401-authentication-error` because the slug generator was using hardcoded `DEFAULT_MODEL` and `DEFAULT_PROVIDER` (Anthropic Opus 4.5) instead of respecting the configured model in `agents.defaults.model.primary`.
## Root Cause
In `src/hooks/llm-slug-generator.ts`, the `generateSlugViaLLM` function calls `runEmbeddedPiAgent` without passing `provider` or `model` parameters. This causes the embedded agent runner to fall back to `DEFAULT_PROVIDER` (anthropic) and `DEFAULT_MODEL` (claude-opus-4-5), which fails with a 401 authentication error when no Anthropic credentials are configured.
## Solution
Modified `src/hooks/llm-slug-generator.ts` to:
1. Resolve the primary model from `agents.defaults.model.primary` config using `resolveAgentModelPrimary`
2. Parse the model ref to extract provider and model using `parseModelRef`
3. Pass these to `runEmbeddedPiAgent` explicitly
## Changes
- **src/hooks/llm-slug-generator.ts** (9 lines added):
- Import `resolveAgentModelPrimary` and `parseModelRef`
- Resolve primary model before calling `runEmbeddedPiAgent`
- Pass `provider` and `model` parameters to use configured model
## Impact
- ✅ Memory files now use the configured local model for slug generation
- ✅ No more authentication errors when using only local models
- ✅ Backward compatible: falls back to defaults if no primary model configured
- ✅ Minimal, focused change (single file, 9 lines)
## Test Plan
- Users with local models in `agents.defaults.model.primary` will now see proper slugs instead of `http-401-authentication-error`
- Users with Anthropic models configured will continue to work as before
- Users without any model configured will fall back to defaults (existing behavior)
🤖 Generated by agent-02ba4d8b8abd via [AgentGit](https://github.com/agentgit)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates `src/hooks/llm-slug-generator.ts` so the one-off embedded Pi agent used for memory-file slug generation receives an explicit `provider`/`model` derived from the configured primary model, instead of relying on embedded-runner defaults.
The change fits into the existing agent/model selection system by reusing `resolveAgentModelPrimary` and `parseModelRef` to derive the model reference before calling `runEmbeddedPiAgent`.
<h3>Confidence Score: 3/5</h3>
- Not safe to merge as-is due to a remaining config scenario that still defaults to Anthropic and can reproduce the 401 failure mode.
- The core fix (passing provider/model into the embedded runner) is correct, but the current parsing forces `anthropic` as the default provider when the configured model ref omits a provider, which can still break local-only setups depending on how users specify `agents.defaults.model.primary`. Unable to run tests in this environment (pnpm missing), so confidence is reduced.
- src/hooks/llm-slug-generator.ts
<!-- greptile_other_comments_section -->
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#5945: fix: use configured model for slug generator (AI-assisted)
by HEDELKA · 2026-02-01
90.4%
#23286: fix: use configured model in llm-slug-generator instead of hardcoded …
by wsman · 2026-02-22
90.4%
#15574: fix(hooks): use configured model for llm slug generation (#15510)
by TsekaLuk · 2026-02-13
89.3%
#18867: fix: route slug generator LLM call through configured provider
by Celegormhenry · 2026-02-17
88.2%
#13401: fix: slug generator should use agent's primary model instead of har...
by pahud · 2026-02-10
88.0%
#4793: hooks: use configured model for slug generator
by yoyooyooo · 2026-01-30
86.4%
#7981: fix(runner): use configured primary model as fallback default
by PiyushDuggal-source · 2026-02-03
84.8%
#21735: fix(hooks): pass configured model to slug generator (#21650)
by lailoo · 2026-02-20
82.0%
#20712: fix(subagents): prioritize agent runtime default model over global ...
by sourcesavant · 2026-02-19
80.6%
#11562: Fix #10883: Enforce subagent model configuration
by divol89 · 2026-02-08
80.4%