fix: use getAgentDisplayName in injectBoulderContinuation

The agent parameter was using raw config key "atlas" but the SDK
expects the display name "Atlas (Plan Executor)". This caused
"Agent not found: 'atlas'" errors when auto-compact tried to
continue boulder execution.

Root cause: injectBoulderContinuation passed raw agent key to
session.promptAsync, but SDK's agent matching logic compares
against display names registered in the system.

Fix: Use getAgentDisplayName() to convert the config key to
the expected display name before passing to the SDK.
This commit is contained in:
WhiteGiverMa
2026-03-27 13:22:58 +08:00
parent 7ce7a85768
commit a3b84ec5f9
@@ -2,6 +2,7 @@ import type { PluginInput } from "@opencode-ai/plugin"
import type { BackgroundManager } from "../../features/background-agent"
import { log } from "../../shared/logger"
import { createInternalAgentTextPart, resolveInheritedPromptTools } from "../../shared"
import { getAgentDisplayName } from "../../shared/agent-display-names"
import { HOOK_NAME } from "./hook-name"
import { BOULDER_CONTINUATION_PROMPT } from "./system-reminder-templates"
import { resolveRecentPromptContextForSession } from "./recent-model-resolver"
@@ -62,7 +63,7 @@ export async function injectBoulderContinuation(input: {
await ctx.client.session.promptAsync({
path: { id: sessionID },
body: {
agent: agent ?? "atlas",
agent: getAgentDisplayName(agent ?? "atlas"),
...(promptContext.model !== undefined ? { model: promptContext.model } : {}),
...(inheritedTools ? { tools: inheritedTools } : {}),
parts: [createInternalAgentTextPart(prompt)],