← Back to PRs

#15574: fix(hooks): use configured model for llm slug generation (#15510)

by TsekaLuk open 2026-02-13 16:36 View on GitHub →
gateway stale size: S
## Summary Fixes `session-memory` / `llm-slug-generator` using hardcoded Anthropic defaults by explicitly inheriting the configured agent default model. Closes #15510. ## Problem `generateSlugViaLLM()` called `runEmbeddedPiAgent()` without provider/model, which falls back to global defaults (`anthropic/claude-opus-4-6`). In setups without Anthropic auth, this causes slug generation to fail despite a valid configured primary model/provider. ## Root Cause The slug generator resolved agent/workspace context but did not resolve and pass the configured default model reference. ## Changes - `src/hooks/llm-slug-generator.ts` - Resolve default model via `resolveDefaultModelForAgent({ cfg, agentId })`. - Pass `provider` + `model` explicitly into `runEmbeddedPiAgent()`. - `src/hooks/llm-slug-generator.test.ts` (new) - Verifies configured model (`minimax/MiniMax-M2.5`) is used for slug generation calls. - Verifies fallback to built-in defaults when no model is configured. ## Tests - `pnpm vitest run src/hooks/llm-slug-generator.test.ts src/hooks/bundled/session-memory/handler.test.ts` - Passed (12/12). - `pnpm vitest run src/hooks/bundled/session-memory/handler.test.ts src/infra/heartbeat-runner.returns-default-unset.test.ts` - Passed (43/43). ## Sign-Off lobster-biscuit <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates the LLM slug generator hook to explicitly inherit the configured default model (via `resolveDefaultModelForAgent`) and pass `provider`/`model` into `runEmbeddedPiAgent`, preventing fallback to the hardcoded Anthropic defaults when a non‑Anthropic primary model is configured. It also adds a focused unit test that mocks the embedded agent runner and agent scope resolution to assert: - a configured default model (e.g. `minimax/MiniMax-M2.5`) is propagated into the embedded run - the built-in defaults (`anthropic/claude-opus-4-6`) are used when no model is configured Overall, the change fits cleanly into existing model-selection infrastructure (`src/agents/model-selection.ts`) and leverages the same default constants used by the embedded runner (`src/agents/defaults.ts`). <h3>Confidence Score: 4/5</h3> - This PR is likely safe to merge, with one test-shape issue to address. - The runtime change is small and uses the existing model-resolution helper to avoid unintended Anthropic fallbacks; the main remaining concern is that the new test may be using a config shape that doesn’t match what `OpenClawConfig` actually supports in practice, which can lead to brittle or misleading coverage. - src/hooks/llm-slug-generator.test.ts <sub>Last reviewed commit: 4faff63</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs