fix(agent-display): remove zero-width sort prefixes from runtime names#3352
Open
LeekJay wants to merge 1 commit intocode-yeongyu:devfrom
Open
fix(agent-display): remove zero-width sort prefixes from runtime names#3352LeekJay wants to merge 1 commit intocode-yeongyu:devfrom
LeekJay wants to merge 1 commit intocode-yeongyu:devfrom
Conversation
The zero-width spaces (\u200B) used to force core agents to sort first in the UI
were causing string corruption (like missing 'U' in 'Ultraworker') when
OpenCode rendered the labels in its TUI.
Changes:
- Removed AGENT_LIST_SORT_PREFIXES entirely.
- getAgentRuntimeName now returns identical to getAgentDisplayName.
- Added defense-in-depth stripInvisibleAgentCharacters to CLI terminal
output renderer to ensure clean strings.
- Updated related tests to assert ZWSP is no longer present.
Impact:
- Fixes TUI label corruption where characters were visually truncated.
- Agent sorting now relies strictly on the order property injection via
CANONICAL_CORE_AGENT_ORDER rather than locale string comparison.
There was a problem hiding this comment.
1 issue found across 6 files
Confidence score: 5/5
- This PR looks low risk to merge because the only reported issue is a low-severity documentation/comment mismatch (2/10) rather than a behavioral or runtime defect.
- The note in
src/shared/agent-display-names.tsshould be updated so the comment matches current behavior (no runtime sort prefixes fromgetAgentRuntimeName()), which helps prevent future confusion during maintenance. - Pay close attention to
src/shared/agent-display-names.ts- align the outdated comment with the new no-prefix behavior.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/shared/agent-display-names.ts">
<violation number="1" location="src/shared/agent-display-names.ts:63">
P3: Update this comment to match the new no-prefix behavior; it still says `getAgentRuntimeName()` adds runtime sort prefixes.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Comment on lines
+63
to
+64
| * This must stay human-readable. Runtime sort prefixes belong only in the | ||
| * agent `name` field via getAgentRuntimeName(). |
There was a problem hiding this comment.
P3: Update this comment to match the new no-prefix behavior; it still says getAgentRuntimeName() adds runtime sort prefixes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/shared/agent-display-names.ts, line 63:
<comment>Update this comment to match the new no-prefix behavior; it still says `getAgentRuntimeName()` adds runtime sort prefixes.</comment>
<file context>
@@ -56,25 +46,25 @@ export function getAgentRuntimeName(configKey: string): string {
- * Runtime-facing agent name used for OpenCode list ordering.
+ * List-facing agent display name.
+ *
+ * This must stay human-readable. Runtime sort prefixes belong only in the
+ * agent `name` field via getAgentRuntimeName().
*/
</file context>
Suggested change
| * This must stay human-readable. Runtime sort prefixes belong only in the | |
| * agent `name` field via getAgentRuntimeName(). | |
| * This must stay human-readable. | |
| * Runtime and list display names are intentionally identical here. |
87a8eac to
f5927e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AGENT_LIST_SORT_PREFIXESentirely to prevent string corruption (like missing 'U' in 'Ultraworker') when OpenCode renders labels in its TUI.getAgentRuntimeNameto return identical clean strings asgetAgentDisplayName.stripInvisibleAgentCharacters) to ensure no residual invisible characters are printed.Changes
src/shared/agent-display-names.tsto remove the ZWSP-based prefix injection, relying strictly on the existingorderproperty injection viaCANONICAL_CORE_AGENT_ORDERfor agent list sorting.src/cli/run/output-renderer.tsto aggressively clean the agent string before printing it withpicocolors.src/cli/run/output-renderer.test.ts.src/shared/agent-display-names.test.ts,src/plugin-handlers/agent-key-remapper.test.tsandsrc/plugin-handlers/command-config-handler.test.tsto assert that zero-width space characters are no longer present.Testing
bun run typecheck bun testSummary by cubic
Removed zero-width sort prefixes from agent names to fix truncated TUI labels. Runtime and list display names are now clean and consistent, and the CLI strips invisible characters before printing.
getAgentRuntimeNameandgetAgentListDisplayNamenow matchgetAgentDisplayName.CANONICAL_CORE_AGENT_ORDER.stripInvisibleAgentCharactersand falls back to color profiles by clean name before styling withpicocolors; added arenderAgentHeadertest and updated related tests to assert no zero-width chars.Written for commit f5927e4. Summary will update on new commits.