Files
orca/src/shared/agent-session-chat-label.ts
T
Brennan BensonandMerge Sim bffdad9f05 fix(native-chat): make structured chat tabs renameable (#19153)
* fix(native-chat): let a structured chat tab be renamed

Renaming a native chat tab accepted the text and silently did nothing:
setTabCustomTitle only scanned terminal tabs and only bridged to unified
tabs whose contentType was 'terminal', so the agent-session tab it was
keyed to never matched. Any label that did land was then re-nulled by the
next host snapshot, which preserved color/createdAt/isPinned but not
customLabel.

Also routes both placeholder sites through one helper so a Claude chat
stops falling back to 'Codex Chat'.

* test(native-chat): cover structured chat tab rename and label fallback

* chore: drop the local @pnpm/exe lockfile artifact

Swept in accidentally; running pnpm here adds @pnpm/exe to the root
lockfile, which fails CI's frozen-lockfile guard.

* fix(native-chat): reach the rename shortcut and tab color too

Review found the first fix covered only the context-menu path. The
tab.rename shortcut gated on activeTabType === 'terminal', so on a
structured chat tab it stayed the silent no-op this branch set out to
fix. setTabColor carried the identical terminal-only lookup one function
below the one that was fixed.

Both lookups now share one resolver instead of two copies.

* fix(native-chat): stop unknown agents reading as Codex, cover the terminal path

Review found the placeholder helper encoded "unknown means Codex": its
signature accepts null/undefined and Tab.agentSessionAgent is the open
AgentType, so the first caller passing a Tab would label gemini or grok
as "Codex Chat". Routed through the shared agent-name table instead.

Also adds the missing regression test that a terminal rename still
resolves through its entityId now that both rename and color share one
resolver, and a guard on a test that passed with the fix reverted.

* fix(native-chat): degrade instead of throwing on a null tab title

A stacked branch can publish title: null when a conversation name is
cleared. The wire type says string, so this consumer trusted it and
threw inside the store patch that applies the snapshot. Fall back to the
placeholder — the producer bug is fixed separately, but a consumer of
wire data should not crash on a contract violation.

* fix(native-chat): rename the focused structured tab, not a background terminal

* fix(native-chat): cycle terminals from the structured tab, not a stale terminal

---------

Co-authored-by: Merge Sim <sim@local>
2026-09-07 09:36:14 -07:00

10 lines
468 B
TypeScript

import type { AgentType } from './agent-status-types'
import { formatAgentTypeLabel } from './agent-type-label'
/** Placeholder tab label for a structured chat that has no conversation name yet.
* Routed through the shared agent-name table so an agent this build does not
* know reads as itself rather than silently as Codex. */
export function defaultAgentChatLabel(agent: AgentType | null | undefined): string {
return `${formatAgentTypeLabel(agent)} Chat`
}