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
+3 -3
View File
@@ -54,11 +54,11 @@ export function createNoHephaestusNonGptHook(
if (allowNonGptModel) {
return
}
input.agent = SISYPHUS_DISPLAY
input.agent = "sisyphus"
if (output?.message) {
output.message.agent = SISYPHUS_DISPLAY
output.message.agent = "sisyphus"
}
updateSessionAgent(input.sessionID, SISYPHUS_DISPLAY)
updateSessionAgent(input.sessionID, "sisyphus")
}
},
}
@@ -40,8 +40,8 @@ describe("no-hephaestus-non-gpt hook", () => {
// then - toast is shown and agent is switched to sisyphus
expect(showToast).toHaveBeenCalledTimes(2)
expect(output1.message.agent).toBe(SISYPHUS_DISPLAY)
expect(output2.message.agent).toBe(SISYPHUS_DISPLAY)
expect(output1.message.agent).toBe("sisyphus")
expect(output2.message.agent).toBe("sisyphus")
expect(showToast.mock.calls[0]?.[0]).toMatchObject({
body: {
title: "NEVER Use Hephaestus with Non-GPT",
@@ -141,6 +141,6 @@ describe("no-hephaestus-non-gpt hook", () => {
// then - toast shown via session-agent fallback, switched to sisyphus
expect(showToast).toHaveBeenCalledTimes(1)
expect(output.message.agent).toBe(SISYPHUS_DISPLAY)
expect(output.message.agent).toBe("sisyphus")
})
})