Skip to content

fix(tui): show the agent name in the prompt ribbon - #57730

Closed
lab1207 wants to merge 1 commit into
anomalyco:devfrom
lab1207:fix/tui-agent-label-uses-name
Closed

lab1207 wants to merge 1 commit into
anomalyco:devfrom
lab1207:fix/tui-agent-label-uses-name

Conversation

@lab1207

@lab1207 lab1207 commented Oct 21, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #57722

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The prompt ribbon titlecased the agent id, so a custom agent work-item was shown as Work-Item. The label did not match the identifier users configure and reference.

packages/tui/src/component/prompt/index.tsx built the label with Locale.titlecase(agent.id). Agent.Info already carries a name, and the API returns the lowercase id as the name for custom agents (work-item), while the built-ins keep their display names (General, Explore). The label now uses agent.name, so custom agents show the id they are configured under and the built-ins are unchanged.

How did you verify your code works?

I could not run the TUI suite here: this environment has no bun (and no installed node_modules), so bun test packages/tui did not run and the app could not be started to look at the ribbon.

What I checked by reading the code:

  • Agent.Info (packages/schema/src/agent.ts) has both id: ID and name: Name, and its default helper sets name: Name.make(id), so a custom agent's name is its id.
  • local.agent.current() (packages/tui/src/context/local.tsx) returns that same Agent.Info, so agent.name is the display name the API sent.
  • Locale is still used twice elsewhere in the file, so the import stays needed.

This is the same class of bug as #30372, which fixed capitalize on custom agent identifiers in the legacy app prompt selector.

Screenshots / recordings

N/A — the ribbon shows a text label, and I could not start the app in this environment to capture one.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Model: MiniMax M3.1 Flash Free via the opencode agent harness (minimax-m3.1-flash-free)


Added by the opencode bot (AI-generated).

Related: #30372

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • Not all checklist items are checked. Please confirm you have tested locally and have not included unrelated changes.

Please edit this PR description to address the above within 72 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The label change works: with a custom work-item agent the ribbon showed Work-Item on the base and shows work-item with this PR, and built-in agents keep their names (Build, Plan…). I checked this by running both checkouts from source with opencode-drive. bun run typecheck in packages/tui passes.

This can't be merged yet because it breaks 28 tests in packages/tui. bun test there gives 30 failures with this PR and 2 on the base; the 2 are the same shell-output timeouts in both. The fake /api/agent replies in test/app-lifecycle.test.tsx, test/session-panel.test.tsx, test/new-session-id.test.tsx and test/prompt-shell-failure.test.tsx send { id: "build", … } with no name. Now that the label reads agent.name, it is empty there, the ribbon doesn't show, and the tests time out waiting for Demo Model. Adding name: "Build" to those fixtures (11 lines) makes all four files pass again, and they belong in this PR.

A design point for maintainers: #57722 was answered as a deliberate choice, because the TUI titlecases agent ids in many other places (the user message header, "Switched agent from … to …", subagent titles, the mini footer). With only the ribbon changed, a custom agent shows as work-item in the ribbon but Work-Item in the transcript right above it.

Public API: unchanged.

Related: #30372

Before

After

const model = local.model.parsed()
return {
agentLabel: agent ? Locale.titlecase(agent.id) : undefined,
agentLabel: agent ? agent.name : undefined,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks 28 tests in packages/tui. Their fake /api/agent replies leave out name ({ id: "build", mode: "primary", hidden: false, permissions: [] } in test/app-lifecycle.test.tsx, test/session-panel.test.tsx, test/new-session-id.test.tsx, test/prompt-shell-failure.test.tsx), so agentLabel is now undefined, the ribbon doesn't show, and the tests time out waiting for Demo Model. Agent.Info requires name, so the right fix is to add name: "Build" to those fixtures rather than to fall back to the id here. With that change all four files pass locally.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 72-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 26, 2026
@github-actions github-actions Bot closed this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tui: prompt ribbon titlecases custom agent ids instead of showing agent.name

1 participant