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:
@@ -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>;
|
||||
|
||||
Reference in New Issue
Block a user