fix(agent-key): remove ZWSP from config object keys for RFC 7230 compliance#3378
fix(agent-key): remove ZWSP from config object keys for RFC 7230 compliance#3378code-yeongyu wants to merge 2 commits intodevfrom
Conversation
…liance Object keys used in plugin config can flow into HTTP header values. ZWSP (U+200B) characters in keys violate RFC 7230 which requires visible ASCII characters in header field values. Changes: - Use getAgentDisplayName() instead of getAgentListDisplayName() for config object keys (no ZWSP) - Keep ZWSP only in agent 'name' field for UI sorting purposes - Add RFC 7230 compliance tests verifying no ZWSP in object keys - Fix stale comments referencing non-existent x-opencode-agent-name header Related: #3220
There was a problem hiding this comment.
No issues found across 14 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Fixes RFC 7230 compliance by removing ZWSP from config keys while preserving it in 'name' fields for UI sorting. Includes comprehensive test coverage for the changes.
…DisplayName getAgentDisplayName now strips ZWSP characters before lookup. This handles cases where a ZWSP-prefixed runtime name (e.g., from default_agent config) is passed to the function. Also fixes generate-omo-config test expectations to use correct model ID format (claude-opus-4.6 after provider transformation). Related: #3220
There was a problem hiding this comment.
0 issues found across 3 files (changes from recent commits).
Requires human review: Refactor calls 'stripInvisibleAgentCharacters' in agent-display-names.ts, but the function's definition is not visible in the diff, making it impossible to verify it won't cause a ReferenceError.
|
Closing this PR. The root cause was found in OpenCode's Solution for users: Upgrade OpenCode to 1.4.3 or later. The hardening changes in this PR are not necessary since the upstream bug is fixed. If RFC 7230 compliance becomes relevant in the future, we can revisit. |
Summary
Removes ZWSP (U+200B) characters from config object keys to comply with RFC 7230 header value requirements.
Changes
getAgentDisplayName()instead ofgetAgentListDisplayName()for config object keysnamefield (user-facing display for UI sorting)x-opencode-agent-nameheaderWhy This Matters
Object keys in plugin config can flow into HTTP header values in some contexts. ZWSP characters violate RFC 7230 which requires visible ASCII characters in header field values.
Scope Clarification
This PR provides hardening within oh-my-opencode constraints.
The root cause of #3220 (agents not appearing after OpenCode 1.4.0 upgrade) is an OpenCode plugin loading order issue where
Agent.list()reads from static config before plugin hooks are registered. Full resolution requires OpenCode changes which are outside our scope.This fix ensures:
namefield for UI sorting (user experience preserved)Related
Fixes #3220auto-close trigger)Testing
namefield verified by testsSummary by cubic
Removes zero‑width spaces from config object keys and switches to HTTP‑safe display names to comply with RFC 7230. Also normalizes ZWSP‑prefixed runtime names and fixes model ID formatting, reducing header validation issues related to #3220.
getAgentDisplayName()for config keys anddefault_agent; stop usinggetAgentListDisplayName().agent.name; add tests ensuring no ZWSP in keys and presence in names.getAgentDisplayName()now strips ZWSP prefixes from runtime inputs.claude-opus-4.6).Written for commit 44860d8. Summary will update on new commits.