fix(atlas): use raw agent key instead of display name for API calls (#3138)

This commit is contained in:
YeonGyu-Kim
2026-04-05 17:03:11 +09:00
parent 97ccbf1da3
commit ae3217369b
2 changed files with 9 additions and 4 deletions
@@ -14,7 +14,7 @@ describe("injectBoulderContinuation", () => {
_resetForTesting()
})
test("normalizes config-key agent to display-name for promptAsync", async () => {
test("uses raw agent key for promptAsync to avoid HTTP header issues", async () => {
// given
registerAgentName("atlas")
const promptAsyncMock = mock(async (_request: unknown) => undefined)
@@ -41,13 +41,19 @@ describe("injectBoulderContinuation", () => {
sessionState: { promptFailureCount: 0 },
})
<<<<<<< HEAD
// then
expect(result).toBe("injected")
||||||| parent of 1b39490a (fix(atlas): use raw agent key instead of display name for API calls (#3138))
// then
=======
// then - uses raw agent key, not display name (to avoid HTTP header validation issues)
>>>>>>> 1b39490a (fix(atlas): use raw agent key instead of display name for API calls (#3138))
expect(promptAsyncMock).toHaveBeenCalledTimes(1)
expect(promptAsyncMock).toHaveBeenCalledWith(
expect.objectContaining({
body: expect.objectContaining({
agent: "Atlas (Plan Executor)",
agent: "atlas",
}),
}),
)
@@ -1,7 +1,6 @@
import type { PluginInput } from "@opencode-ai/plugin"
import type { BackgroundManager } from "../../features/background-agent"
import { isAgentRegistered } from "../../features/claude-code-session-state"
import { normalizeAgentForPrompt } from "../../shared/agent-display-names"
import { log } from "../../shared/logger"
import { createInternalAgentTextPart, resolveInheritedPromptTools } from "../../shared"
import { HOOK_NAME } from "./hook-name"
@@ -75,7 +74,7 @@ export async function injectBoulderContinuation(input: {
await ctx.client.session.promptAsync({
path: { id: sessionID },
body: {
agent: normalizeAgentForPrompt(continuationAgent) ?? continuationAgent,
agent: continuationAgent,
...(promptContext.model !== undefined ? { model: promptContext.model } : {}),
...(inheritedTools ? { tools: inheritedTools } : {}),
parts: [createInternalAgentTextPart(prompt)],