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:
@@ -31,7 +31,7 @@ describe("resolveRunAgent", () => {
|
||||
)
|
||||
|
||||
// then
|
||||
expect(agent).toBe("Hephaestus (Deep Agent)")
|
||||
expect(agent).toBe("Hephaestus - Deep Agent")
|
||||
})
|
||||
|
||||
it("uses env agent over config", () => {
|
||||
@@ -43,7 +43,7 @@ describe("resolveRunAgent", () => {
|
||||
const agent = resolveRunAgent({ message: "test" }, config, env)
|
||||
|
||||
// then
|
||||
expect(agent).toBe("Atlas (Plan Executor)")
|
||||
expect(agent).toBe("Atlas - Plan Executor")
|
||||
})
|
||||
|
||||
it("uses config agent over default", () => {
|
||||
@@ -54,7 +54,7 @@ describe("resolveRunAgent", () => {
|
||||
const agent = resolveRunAgent({ message: "test" }, config, {})
|
||||
|
||||
// then
|
||||
expect(agent).toBe("Prometheus (Plan Builder)")
|
||||
expect(agent).toBe("Prometheus - Plan Builder")
|
||||
})
|
||||
|
||||
it("falls back to sisyphus when none set", () => {
|
||||
@@ -65,7 +65,7 @@ describe("resolveRunAgent", () => {
|
||||
const agent = resolveRunAgent({ message: "test" }, config, {})
|
||||
|
||||
// then
|
||||
expect(agent).toBe("Sisyphus (Ultraworker)")
|
||||
expect(agent).toBe("Sisyphus - Ultraworker")
|
||||
})
|
||||
|
||||
it("skips disabled sisyphus for next available core agent", () => {
|
||||
@@ -76,18 +76,18 @@ describe("resolveRunAgent", () => {
|
||||
const agent = resolveRunAgent({ message: "test" }, config, {})
|
||||
|
||||
// then
|
||||
expect(agent).toBe("Hephaestus (Deep Agent)")
|
||||
expect(agent).toBe("Hephaestus - Deep Agent")
|
||||
})
|
||||
|
||||
it("maps display-name style default_run_agent values to canonical display names", () => {
|
||||
// given
|
||||
const config = createConfig({ default_run_agent: "Sisyphus (Ultraworker)" })
|
||||
const config = createConfig({ default_run_agent: "Sisyphus - Ultraworker" })
|
||||
|
||||
// when
|
||||
const agent = resolveRunAgent({ message: "test" }, config, {})
|
||||
|
||||
// then
|
||||
expect(agent).toBe("Sisyphus (Ultraworker)")
|
||||
expect(agent).toBe("Sisyphus - Ultraworker")
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user