fix(agent-names): use HTTP-header-safe display names and config keys for API calls (#3138)

Display names with parentheses like 'Atlas (Plan Executor)' cause HTTP
header validation errors in x-opencode-agent-name. This was blocking
Atlas/Prometheus from working via /start-work and auto-retry.

Changes:
- Display names: parens -> dashes ('Atlas - Plan Executor')
- Hooks (start-work, no-hephaestus-non-gpt, no-sisyphus-gpt): use
  config keys ('atlas', 'sisyphus', 'hephaestus') for agent API fields
- auto-retry: use config key instead of display name for promptAsync
- agent-override-protection: handle dash-suffix normalization
- Updated all test expectations to match new format

Closes #3138
This commit is contained in:
YeonGyu-Kim
2026-04-07 10:08:04 +09:00
parent ebfd4a41ee
commit f8c626086e
26 changed files with 146 additions and 144 deletions
+2 -2
View File
@@ -87,7 +87,7 @@ describe("createChatMessageHandler - /start-work integration", () => {
await handler(input, output)
// then
expect(output.message["agent"]).toBe("Sisyphus (Ultraworker)")
expect(output.message["agent"]).toBe("sisyphus")
expect(output.parts[0].text).toContain("<auto-slash-command>")
expect(output.parts[0].text).toContain("Auto-Selected Plan")
expect(output.parts[0].text).toContain("boulder.json has been created")
@@ -397,7 +397,7 @@ describe("createChatMessageHandler - TUI variant passthrough", () => {
//#then
expect(output.message["model"]).toBeUndefined()
expect(getSessionModel("test-session")).toEqual({ providerID: "openai", modelID: "gpt-5.4" })
expect(getSessionAgent("test-session")).toBe("Prometheus (Plan Builder)")
expect(getSessionAgent("test-session")).toBe("Prometheus - Plan Builder")
})
test("respects a mid-conversation model switch instead of reusing the previous stored model", async () => {
+7 -7
View File
@@ -92,8 +92,8 @@ describe("createEventHandler - model fallback", () => {
parentID: "msg_user_1",
modelID: "claude-opus-4-6-thinking",
providerID: "anthropic",
mode: "Sisyphus (Ultraworker)",
agent: "Sisyphus (Ultraworker)",
mode: "Sisyphus - Ultraworker",
agent: "Sisyphus - Ultraworker",
path: { cwd: "/tmp", root: "/tmp" },
cost: 0,
tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } },
@@ -184,7 +184,7 @@ describe("createEventHandler - model fallback", () => {
content: [],
modelID: "claude-opus-4-6-thinking",
providerID: "anthropic",
agent: "Sisyphus (Ultraworker)",
agent: "Sisyphus - Ultraworker",
path: { cwd: "/tmp", root: "/tmp" },
},
},
@@ -246,7 +246,7 @@ describe("createEventHandler - model fallback", () => {
role: "user",
modelID: "claude-opus-4-6-thinking",
providerID: "anthropic",
agent: "Sisyphus (Ultraworker)",
agent: "Sisyphus - Ultraworker",
},
},
},
@@ -314,7 +314,7 @@ describe("createEventHandler - model fallback", () => {
role: "user",
modelID: "claude-opus-4-6",
providerID: "quotio",
agent: "Sisyphus (Ultraworker)",
agent: "Sisyphus - Ultraworker",
},
},
},
@@ -395,7 +395,7 @@ describe("createEventHandler - model fallback", () => {
content: [],
modelID: "claude-opus-4-6",
providerID: "quotio",
agent: "Sisyphus (Ultraworker)",
agent: "Sisyphus - Ultraworker",
path: { cwd: "/tmp", root: "/tmp" },
},
},
@@ -597,7 +597,7 @@ describe("createEventHandler - model fallback", () => {
parentID: "msg_user_disabled_1",
modelID: "claude-opus-4-6-thinking",
providerID: "anthropic",
agent: "Sisyphus (Ultraworker)",
agent: "Sisyphus - Ultraworker",
path: { cwd: "/tmp", root: "/tmp" },
cost: 0,
tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } },
+1 -1
View File
@@ -771,7 +771,7 @@ describe("createEventHandler - retry dedupe lifecycle", () => {
role: "user",
modelID: "claude-opus-4-6-thinking",
providerID: "anthropic",
agent: "Sisyphus (Ultraworker)",
agent: "Sisyphus - Ultraworker",
},
},
},
@@ -255,7 +255,7 @@ async function primeMainSession(
content: [],
modelID: PRIMARY_MODEL.modelID,
providerID: PRIMARY_MODEL.providerID,
agent: "Sisyphus (Ultraworker)",
agent: "Sisyphus - Ultraworker",
path: { cwd: "/tmp", root: "/tmp" },
},
},
@@ -337,7 +337,7 @@ async function triggerAssistantMessageError(
model: PRIMARY_MODEL_STRING,
modelID: PRIMARY_MODEL.modelID,
providerID: PRIMARY_MODEL.providerID,
agent: "Sisyphus (Ultraworker)",
agent: "Sisyphus - Ultraworker",
path: { cwd: "/tmp", root: "/tmp" },
error: {
statusCode: 529,
+2 -2
View File
@@ -174,7 +174,7 @@ describe("resolveUltraworkOverride", () => {
const output = createOutput("ulw do something")
//#when
const result = resolveUltraworkOverride(config, "Sisyphus (Ultraworker)", output)
const result = resolveUltraworkOverride(config, "Sisyphus - Ultraworker", output)
//#then
expect(result).toEqual({ providerID: "anthropic", modelID: "claude-opus-4-6", variant: "max" })
@@ -408,7 +408,7 @@ describe("applyUltraworkModelOverrideOnMessage", () => {
const tui = createMockTui()
//#when
applyUltraworkModelOverrideOnMessage(config, "Sisyphus (Ultraworker)", output, tui)
applyUltraworkModelOverrideOnMessage(config, "Sisyphus - Ultraworker", output, tui)
//#then
expect(dbOverrideSpy).toHaveBeenCalledWith(