fix(atlas): use raw agent key instead of display name for API calls (#3138)
This commit is contained in:
@@ -14,7 +14,7 @@ describe("injectBoulderContinuation", () => {
|
|||||||
_resetForTesting()
|
_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
|
// given
|
||||||
registerAgentName("atlas")
|
registerAgentName("atlas")
|
||||||
const promptAsyncMock = mock(async (_request: unknown) => undefined)
|
const promptAsyncMock = mock(async (_request: unknown) => undefined)
|
||||||
@@ -41,13 +41,19 @@ describe("injectBoulderContinuation", () => {
|
|||||||
sessionState: { promptFailureCount: 0 },
|
sessionState: { promptFailureCount: 0 },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
// then
|
// then
|
||||||
expect(result).toBe("injected")
|
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).toHaveBeenCalledTimes(1)
|
||||||
expect(promptAsyncMock).toHaveBeenCalledWith(
|
expect(promptAsyncMock).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
body: expect.objectContaining({
|
body: expect.objectContaining({
|
||||||
agent: "Atlas (Plan Executor)",
|
agent: "atlas",
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import type { PluginInput } from "@opencode-ai/plugin"
|
import type { PluginInput } from "@opencode-ai/plugin"
|
||||||
import type { BackgroundManager } from "../../features/background-agent"
|
import type { BackgroundManager } from "../../features/background-agent"
|
||||||
import { isAgentRegistered } from "../../features/claude-code-session-state"
|
import { isAgentRegistered } from "../../features/claude-code-session-state"
|
||||||
import { normalizeAgentForPrompt } from "../../shared/agent-display-names"
|
|
||||||
import { log } from "../../shared/logger"
|
import { log } from "../../shared/logger"
|
||||||
import { createInternalAgentTextPart, resolveInheritedPromptTools } from "../../shared"
|
import { createInternalAgentTextPart, resolveInheritedPromptTools } from "../../shared"
|
||||||
import { HOOK_NAME } from "./hook-name"
|
import { HOOK_NAME } from "./hook-name"
|
||||||
@@ -75,7 +74,7 @@ export async function injectBoulderContinuation(input: {
|
|||||||
await ctx.client.session.promptAsync({
|
await ctx.client.session.promptAsync({
|
||||||
path: { id: sessionID },
|
path: { id: sessionID },
|
||||||
body: {
|
body: {
|
||||||
agent: normalizeAgentForPrompt(continuationAgent) ?? continuationAgent,
|
agent: continuationAgent,
|
||||||
...(promptContext.model !== undefined ? { model: promptContext.model } : {}),
|
...(promptContext.model !== undefined ? { model: promptContext.model } : {}),
|
||||||
...(inheritedTools ? { tools: inheritedTools } : {}),
|
...(inheritedTools ? { tools: inheritedTools } : {}),
|
||||||
parts: [createInternalAgentTextPart(prompt)],
|
parts: [createInternalAgentTextPart(prompt)],
|
||||||
|
|||||||
Reference in New Issue
Block a user