From a8a0fea31509600f3f8bc519e35099066ec3c939 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Mon, 13 Apr 2026 11:47:59 +0900 Subject: [PATCH] docs: fix stale comments referencing non-existent x-opencode-agent-name header Per OpenCode source investigation, no such header exists. Updated comments to accurately reflect RFC 7230 compliance concerns for object keys. --- src/plugin-handlers/agent-config-handler.test.ts | 4 ++-- src/shared/agent-display-names.ts | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/plugin-handlers/agent-config-handler.test.ts b/src/plugin-handlers/agent-config-handler.test.ts index db7146f77..00d8d06c3 100644 --- a/src/plugin-handlers/agent-config-handler.test.ts +++ b/src/plugin-handlers/agent-config-handler.test.ts @@ -175,8 +175,8 @@ describe("applyAgentConfig builtin override protection", () => { }) // then every registered agent key must be HTTP-header-safe (no parentheses) - // Parentheses in agent names cause HTTP header validation errors in - // x-opencode-agent-name and prevent the agents from showing in the OpenCode UI. + // Agent keys can flow into HTTP header values in some plugin paths. + // Parentheses and ZWSP characters violate RFC 7230 header value rules. for (const key of Object.keys(result)) { expect(key).not.toMatch(/[()]/) } diff --git a/src/shared/agent-display-names.ts b/src/shared/agent-display-names.ts index 324fac785..6c0c8133b 100644 --- a/src/shared/agent-display-names.ts +++ b/src/shared/agent-display-names.ts @@ -4,10 +4,12 @@ * Display names include suffixes for UI/logs (e.g., "Sisyphus - Ultraworker"). * * IMPORTANT: Display names MUST NOT contain parentheses or other characters - * that are invalid in HTTP header values per RFC 7230. OpenCode passes the - * agent name in the `x-opencode-agent-name` header, and parentheses cause - * header validation failures that prevent agents from appearing in the UI - * type selector dropdown. Use ` - ` (space-dash-space) instead of `(...)`. + * that are invalid in HTTP header values per RFC 7230. Config object keys + * can flow into HTTP header values in some plugin paths. Use ` - ` + * (space-dash-space) instead of `(...)` to avoid header validation failures. + * + * NOTE: ZWSP characters (\u200B) are used ONLY in the `name` field for + * UI sorting. ZWSP MUST NOT appear in object keys (see agent-key-remapper.ts). */ export const AGENT_DISPLAY_NAMES: Record = { sisyphus: "Sisyphus - Ultraworker",