Skip to content

Agent names displayed incorrectly with ZWSP characters in TUI (e.g., "Ultraworker" → "ltraworker") #23049

Description

@CoolstrangerFJ

Description

When using oh-my-openagent plugin with OpenCode TUI, agent names are displayed incorrectly - missing the first few characters. This is caused by zero-width space (ZWSP, U+200B) characters used for sort prefixes in AGENT_LIST_SORT_PREFIXES.

Environment

  • OpenCode version: 1.4.0
  • oh-my-openagent version: 3.17.4
  • Terminal: iTerm2 on macOS
  • TERM: xterm-256color
  • Locale: zh_CN.UTF-8

Symptoms

Expected Actual
Sisyphus - Ultraworker Sisyphus - ltraworker (missing 'U')
Prometheus - Plan Builder Prometheus - Plan lder (missing 'Bui')

The number of missing characters correlates with the number of ZWSP characters in AGENT_LIST_SORT_PREFIXES:

  • sisyphus: 1 ZWSP → 1 char missing
  • prometheus: 3 ZWSPs → 3 chars missing

Root Cause

oh-my-openagent uses ZWSP characters for sorting agent names in the dropdown:

AGENT_LIST_SORT_PREFIXES = {
  sisyphus: "\u200B",
  hephaestus: "\u200B\u200B",
  prometheus: "\u200B\u200B\u200B",
  atlas: "\u200B\u200B\u200B\u200B"
};

While v3.17.3/v3.17.4 added stripInvisibleAgentCharacters() for agent lookups, the TUI display still shows these ZWSP characters, and certain terminals/font configurations render them as having actual width, causing the first visible characters to be "eaten".

Related Issues

Suggested Fix

The OpenCode TUI should properly handle zero-width Unicode characters (U+200B, U+200C, U+200D, U+FEFF) when calculating string width for display. These characters should have zero display width in all terminals.

Alternatively, oh-my-openagent could use a different mechanism for sorting that doesn't involve invisible characters.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions