refactor(agents): drop ZWSP prefixes from agent display names

The sort shim from the previous commit enforces canonical core ordering at runtime, so ZWSP prefixes are no longer needed. Removing them eliminates the Bun.stringWidth vs terminal-width drift that broke the TUI status bar (#3259).

Drop AGENT_LIST_SORT_PREFIXES and getAgentRuntimeName from agent-display-names; switch all call sites to getAgentDisplayName. getAgentListDisplayName stays as a thin alias for external importers.

Keep stripInvisibleAgentCharacters and the ZWSP regex paths so legacy session state and configs from v3.14.0-v3.16.0 still resolve.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-27 17:36:05 +09:00
parent dffe5a305b
commit 333ad3aadd
13 changed files with 201 additions and 70 deletions
+47 -1
View File
@@ -6,7 +6,6 @@ import { randomUUID } from "node:crypto"
import { createPluginInterface } from "./plugin-interface"
import { createAutoSlashCommandHook } from "./hooks/auto-slash-command"
import { createStartWorkHook } from "./hooks/start-work"
import { getAgentListDisplayName } from "./shared/agent-display-names"
import { readBoulderState } from "./features/boulder-state"
import {
_resetForTesting,
@@ -258,3 +257,50 @@ describe("createPluginInterface - ulw-loop native command smoke", () => {
])
})
})
describe("createPluginInterface - backward compatibility", () => {
beforeEach(() => {
_resetForTesting()
registerAgentName("hephaestus")
})
afterEach(() => {
_resetForTesting()
})
test("strips legacy ZWSP-prefixed agent names from persisted chat.message session state (GH-3259)", async () => {
// given - persisted session payload from v3.14.0-v3.16.0 with ZWSP prefix
const pluginInterface = createPluginInterface({
ctx: {
directory: tmpdir(),
client: { tui: { showToast: async () => {} } },
} as never,
pluginConfig: {} as never,
firstMessageVariantGate: {
shouldOverride: () => false,
markApplied: () => {},
markSessionCreated: () => {},
clear: () => {},
},
managers: {} as never,
hooks: {} as never,
tools: {},
})
const output = {
message: {} as Record<string, unknown>,
parts: [{ type: "text", text: "hello" }],
}
// when
await pluginInterface["chat.message"]?.(
{
sessionID: "ses-legacy-zwsp",
agent: "\u200B\u200BHephaestus - Deep Agent",
} as never,
output as never,
)
// then
expect(getSessionAgent("ses-legacy-zwsp")).toBe("Hephaestus - Deep Agent")
})
})