fix(coding-agent/modes): corrected role model cycling order to [smol, default, slow]

- Corrected role model cycling order from [slow, default, smol] to [smol, default, slow] to match expected progression.
This commit is contained in:
can1357
2026-03-11 00:18:07 +01:00
parent 4ed4cfb27c
commit 08a4fe78a2
6 changed files with 35 additions and 19 deletions
@@ -30,7 +30,13 @@ export interface MapPhaseInput {
};
}
export async function runMapPhase({ model, apiKey, thinkingLevel, files, config }: MapPhaseInput): Promise<FileObservation[]> {
export async function runMapPhase({
model,
apiKey,
thinkingLevel,
files,
config,
}: MapPhaseInput): Promise<FileObservation[]> {
const filtered = files.filter(file => !isExcludedFile(file.filename));
const systemPrompt = renderPromptTemplate(fileObserverSystemPrompt);
const maxFileTokens = config?.maxFileTokens ?? MAX_FILE_TOKENS;
@@ -61,7 +67,13 @@ export async function runMapPhase({ model, apiKey, thinkingLevel, files, config
};
const response = await withRetry(
() => completeSimple(model, request, { apiKey, maxTokens: 400, reasoning: toReasoningEffort(thinkingLevel), signal: AbortSignal.timeout(timeoutMs) }),
() =>
completeSimple(model, request, {
apiKey,
maxTokens: 400,
reasoning: toReasoningEffort(thinkingLevel),
signal: AbortSignal.timeout(timeoutMs),
}),
maxRetries,
retryBackoffMs,
);
@@ -1,7 +1,7 @@
import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
import type { Api, Model } from "@oh-my-pi/pi-ai";
import { MODEL_ROLE_IDS } from "../config/model-registry";
import { expandRoleAlias, parseModelPattern, resolveModelRoleValue } from "../config/model-resolver";
import { parseModelPattern, resolveModelRoleValue } from "../config/model-resolver";
import type { Settings } from "../config/settings";
import MODEL_PRIO from "../priority.json" with { type: "json" };
+10 -11
View File
@@ -46,17 +46,16 @@ async function runLegacyCommitCommand(args: CommitCommandArgs): Promise<void> {
const modelRegistry = new ModelRegistry(authStorage);
await modelRegistry.refresh();
const { model: primaryModel, apiKey: primaryApiKey, thinkingLevel: primaryThinkingLevel } = await resolvePrimaryModel(
args.model,
settings,
modelRegistry,
);
const { model: smolModel, apiKey: smolApiKey, thinkingLevel: smolThinkingLevel } = await resolveSmolModel(
settings,
modelRegistry,
primaryModel,
primaryApiKey,
);
const {
model: primaryModel,
apiKey: primaryApiKey,
thinkingLevel: primaryThinkingLevel,
} = await resolvePrimaryModel(args.model, settings, modelRegistry);
const {
model: smolModel,
apiKey: smolApiKey,
thinkingLevel: smolThinkingLevel,
} = await resolveSmolModel(settings, modelRegistry, primaryModel, primaryApiKey);
const git = new ControlledGit(cwd);
let stagedFiles = await git.getStagedFiles();
@@ -580,7 +580,7 @@ export class InputController {
async cycleRoleModel(options?: { temporary?: boolean }): Promise<void> {
try {
const roleOrder = ["slow", "default", "smol"] as const;
const roleOrder = ["smol", "default", "slow"] as const;
const result = await this.ctx.session.cycleRoleModels(roleOrder, options);
if (!result) {
this.ctx.showStatus("Only one role model available");
@@ -9,10 +9,10 @@ import { logger } from "@oh-my-pi/pi-utils";
import type { ModelRegistry } from "../config/model-registry";
import { resolveModelRoleValue } from "../config/model-resolver";
import { renderPromptTemplate } from "../config/prompt-templates";
import { toReasoningEffort } from "../thinking";
import type { Settings } from "../config/settings";
import MODEL_PRIO from "../priority.json" with { type: "json" };
import commitSystemPrompt from "../prompts/system/commit-message-system.md" with { type: "text" };
import { toReasoningEffort } from "../thinking";
const COMMIT_SYSTEM_PROMPT = renderPromptTemplate(commitSystemPrompt);
const MAX_DIFF_CHARS = 4000;
@@ -8,10 +8,10 @@ import { logger } from "@oh-my-pi/pi-utils";
import type { ModelRegistry } from "../config/model-registry";
import { resolveModelRoleValue } from "../config/model-resolver";
import { renderPromptTemplate } from "../config/prompt-templates";
import { toReasoningEffort } from "../thinking";
import type { Settings } from "../config/settings";
import MODEL_PRIO from "../priority.json" with { type: "json" };
import titleSystemPrompt from "../prompts/system/title-system.md" with { type: "text" };
import { toReasoningEffort } from "../thinking";
const TITLE_SYSTEM_PROMPT = renderPromptTemplate(titleSystemPrompt);
@@ -27,7 +27,9 @@ function getTitleModelCandidates(
const candidates: Array<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }> = [];
const addCandidate = (model?: Model<Api>, thinkingLevel?: ThinkingLevel): void => {
if (!model) return;
const exists = candidates.some(candidate => candidate.model.provider === model.provider && candidate.model.id === model.id);
const exists = candidates.some(
candidate => candidate.model.provider === model.provider && candidate.model.id === model.id,
);
if (!exists) {
candidates.push({ model, thinkingLevel });
}
@@ -86,7 +88,10 @@ ${truncatedMessage}
for (const candidate of candidates) {
const apiKey = await registry.getApiKey(candidate.model, sessionId);
if (!apiKey) {
logger.debug("title-generator: no API key for model", { provider: candidate.model.provider, id: candidate.model.id });
logger.debug("title-generator: no API key for model", {
provider: candidate.model.provider,
id: candidate.model.id,
});
continue;
}