fix: only call setDefaultAgentForSort when user explicitly sets default_agent

The previous code read params.config.default_agent which is always populated to
"Sisyphus - Ultraworker" by existing logic (lines 196-204) even when the user
never configured default_agent. This silently overrode any custom agent_order.

Now we gate on configuredDefaultAgent (the user's explicit value) so the sort
shim rank map is only mutated when the user actually set default_agent.

Add regression test: agent_order without default_agent must preserve order.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-05-18 13:42:59 +09:00
parent ec7168eb6c
commit f5e063b00a
2 changed files with 25 additions and 3 deletions
+4 -3
View File
@@ -400,9 +400,10 @@ export async function applyAgentConfig(params: {
);
}
const resolvedDefault = (params.config as { default_agent?: string }).default_agent;
if (resolvedDefault) {
setDefaultAgentForSort(resolvedDefault);
if (configuredDefaultAgent) {
setDefaultAgentForSort(
(params.config as { default_agent?: string }).default_agent ?? configuredDefaultAgent,
);
}
const agentResult = params.config.agent as Record<string, unknown>;