fix: slug-generator uses configured default model instead of hardcoded Opus
Resolves #4315. The slug-generator embedded run was hardcoded to use DEFAULT_MODEL (claude-opus-4-5) regardless of the user's configured agents.defaults.model.primary. This caused unexpected Opus charges on every /new command. Now uses resolveDefaultModelForAgent() to honor the user's configured default model, falling back to DEFAULT_MODEL only when no config exists.
This commit is contained in:
parent
87267fad4f
commit
ee50fb8528
@ -12,6 +12,7 @@ import {
|
||||
resolveAgentWorkspaceDir,
|
||||
resolveAgentDir,
|
||||
} from "../agents/agent-scope.js";
|
||||
import { resolveDefaultModelForAgent } from "../agents/model-selection.js";
|
||||
|
||||
/**
|
||||
* Generate a short 1-2 word filename slug from session content using LLM
|
||||
@ -38,6 +39,11 @@ ${params.sessionContent.slice(0, 2000)}
|
||||
|
||||
Reply with ONLY the slug, nothing else. Examples: "vendor-pitch", "api-design", "bug-fix"`;
|
||||
|
||||
// Resolve user's configured default model instead of hardcoded Opus
|
||||
const { provider, model } = resolveDefaultModelForAgent({
|
||||
cfg: params.cfg,
|
||||
});
|
||||
|
||||
const result = await runEmbeddedPiAgent({
|
||||
sessionId: `slug-generator-${Date.now()}`,
|
||||
sessionKey: "temp:slug-generator",
|
||||
@ -46,6 +52,8 @@ Reply with ONLY the slug, nothing else. Examples: "vendor-pitch", "api-design",
|
||||
agentDir,
|
||||
config: params.cfg,
|
||||
prompt,
|
||||
provider,
|
||||
model,
|
||||
timeoutMs: 15_000, // 15 second timeout
|
||||
runId: `slug-gen-${Date.now()}`,
|
||||
});
|
||||
@ -75,7 +83,10 @@ Reply with ONLY the slug, nothing else. Examples: "vendor-pitch", "api-design",
|
||||
// Clean up temporary session file
|
||||
if (tempSessionFile) {
|
||||
try {
|
||||
await fs.rm(path.dirname(tempSessionFile), { recursive: true, force: true });
|
||||
await fs.rm(path.dirname(tempSessionFile), {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
} catch {
|
||||
// Ignore cleanup errors
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user