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:
@@ -43,11 +43,11 @@ export function createNoSisyphusGptHook(ctx: PluginInput) {
|
||||
|
||||
if (agentKey === "sisyphus" && modelID && isGptModel(modelID) && !isGpt5_4Model(modelID)) {
|
||||
showToast(ctx, input.sessionID)
|
||||
input.agent = HEPHAESTUS_DISPLAY
|
||||
input.agent = "hephaestus"
|
||||
if (output?.message) {
|
||||
output.message.agent = HEPHAESTUS_DISPLAY
|
||||
output.message.agent = "hephaestus"
|
||||
}
|
||||
updateSessionAgent(input.sessionID, HEPHAESTUS_DISPLAY)
|
||||
updateSessionAgent(input.sessionID, "hephaestus")
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ describe("no-sisyphus-gpt hook", () => {
|
||||
|
||||
// then - toast is shown for every message
|
||||
expect(showToast).toHaveBeenCalledTimes(2)
|
||||
expect(output1.message.agent).toBe(HEPHAESTUS_DISPLAY)
|
||||
expect(output2.message.agent).toBe(HEPHAESTUS_DISPLAY)
|
||||
expect(output1.message.agent).toBe("hephaestus")
|
||||
expect(output2.message.agent).toBe("hephaestus")
|
||||
expect(showToast.mock.calls[0]?.[0]).toMatchObject({
|
||||
body: {
|
||||
title: "NEVER Use Sisyphus with GPT",
|
||||
@@ -131,6 +131,6 @@ describe("no-sisyphus-gpt hook", () => {
|
||||
|
||||
// then - toast shown via session-agent fallback
|
||||
expect(showToast).toHaveBeenCalledTimes(1)
|
||||
expect(output.message.agent).toBe(HEPHAESTUS_DISPLAY)
|
||||
expect(output.message.agent).toBe("hephaestus")
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user