fix: respect default_agent in sort shim ordering (#3900)
The sort shim always placed core agents (sisyphus, hephaestus, prometheus, atlas) before any custom agent, ignoring the user's configured default_agent in opencode.json. This caused the TUI to always show Sisyphus as the selected agent on startup regardless of default_agent. Add setDefaultAgentForSort() which inserts the configured default_agent at rank 0 in the sort shim's rank map. Called from applyAgentConfig after resolving the effective default_agent value. Fixes #3900
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
normalizeAgentForPromptKey,
|
||||
} from "../shared/agent-display-names";
|
||||
import { AGENT_NAME_MAP } from "../shared/migration";
|
||||
import { setDefaultAgentForSort } from "../shared/agent-sort-shim";
|
||||
import { registerAgentName } from "../features/claude-code-session-state";
|
||||
import {
|
||||
discoverConfigSourceSkills,
|
||||
@@ -399,6 +400,11 @@ export async function applyAgentConfig(params: {
|
||||
);
|
||||
}
|
||||
|
||||
const resolvedDefault = (params.config as { default_agent?: string }).default_agent;
|
||||
if (resolvedDefault) {
|
||||
setDefaultAgentForSort(resolvedDefault);
|
||||
}
|
||||
|
||||
const agentResult = params.config.agent as Record<string, unknown>;
|
||||
for (const name of Object.keys(agentResult)) {
|
||||
registerAgentName(name);
|
||||
|
||||
Reference in New Issue
Block a user