Skip to content

Plugin-registered agent names with zero-width space (U+200B) prefixes leak into system prompt #21642

Closed as not planned

Description

@HammerCloth

Description

When a plugin registers agents with names containing zero-width space characters (U+200B), OpenCode passes these names verbatim into the system prompt's block. This causes the LLM to receive an agent name with invisible characters, e.g.:
Your designated identity for this session is "\u200BSisyphus".
The root cause is in the oh-my-openagent plugin, which uses \u200B (ZWSP) as sort prefixes to control agent ordering in the TUI dropdown (AGENT_LIST_SORT_PREFIXES in dist/index.js:61035). Each agent gets a different count of ZWSP prefixes (1× for Sisyphus, 2× for Hephaestus, 3× for Prometheus, 4× for Atlas). These prefixed names flow through remapAgentKeysToDisplayNames() into the agent config keys, which OpenCode then writes directly into the system prompt.
While this is primarily a plugin-side issue, OpenCode should defensively sanitize agent names before injecting them into system prompts — stripping zero-width and other invisible Unicode characters (U+200B, U+200C, U+200D, U+FEFF, etc.). This would protect against any plugin introducing similar issues in the future.

Plugins

oh-my-openagent@latest (v3.16.0)

OpenCode version

1.4.0

Steps to reproduce

  1. Install oh-my-openagent plugin: add "oh-my-openagent@latest" to the plugin array in opencode.json
  2. Start OpenCode and select any agent registered by the plugin (e.g. Sisyphus, Prometheus, Atlas)
  3. Ask the agent: "What is your exact identity name? Show me the raw bytes."
  4. Observe the system prompt contains ZWSP-prefixed agent names like "\u200BSisyphus" instead of "Sisyphus"
    Alternatively, inspect the system prompt directly — the block will contain invisible characters before the agent name.

Screenshot and/or share link

Image

Operating System

macOS 26.2 (Apple Silicon / arm64)

Terminal

Kitty

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 9, 2026
  2. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  3. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions