Repository navigation
fix(notes): name each agent in Send notes to by its sidebar name instead of its type #35977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,8 @@ import type { DashboardAgentRow as DashboardAgentRowData } from '@/components/da | |
| import { lastEnteredDoneAt } from '@/components/dashboard/agent-finished-timestamp' | ||
| import { selectLivePtyIdsForWorktree } from '@/components/sidebar/worktree-card-status-inputs' | ||
| import { useWorktreeAgentRows } from '@/components/sidebar/useWorktreeAgentRows' | ||
| import { useAgentRowConversationName } from '@/components/dashboard/use-agent-row-conversation-name' | ||
| import { getAgentRowPrimaryText } from '../../../../shared/agent-row-primary-text' | ||
| import type { LaunchSource } from '../../../../shared/telemetry-events' | ||
| import { agentRowDisplayDotState } from '@/lib/agent-row-dot-state' | ||
| import { translate } from '@/i18n/i18n' | ||
|
|
@@ -189,16 +191,19 @@ export function ReviewNotesSendMenuContent({ | |
| <DropdownMenuLabel> | ||
| {translate('auto.components.editor.ReviewNotesSendMenuContent.03378aea75', 'Send notes to')} | ||
| </DropdownMenuLabel> | ||
| {orderedSendTargets.map(({ target, agent }) => ( | ||
| <AgentTargetMenuItem | ||
| key={target.paneKey} | ||
| target={target} | ||
| agent={agent} | ||
| now={now} | ||
| disabled={!hasPrompt || target.status !== 'eligible'} | ||
| onSend={sendToAgentTarget} | ||
| /> | ||
| ))} | ||
| {orderedSendTargets.map(({ target, agent }) => { | ||
| const itemProps = { | ||
| target, | ||
| now, | ||
| disabled: !hasPrompt || target.status !== 'eligible', | ||
| onSend: sendToAgentTarget | ||
| } | ||
| return agent ? ( | ||
| <AgentRowTargetMenuItem key={target.paneKey} {...itemProps} agent={agent} /> | ||
| ) : ( | ||
| <AgentTargetMenuItem key={target.paneKey} {...itemProps} agent={null} name="" /> | ||
| ) | ||
| })} | ||
| <DropdownMenuSeparator /> | ||
| <DropdownMenuLabel> | ||
| {translate('auto.components.editor.ReviewNotesSendMenuContent.a49800405b', 'New agent')} | ||
|
|
@@ -249,20 +254,33 @@ function resolveCurrentSendTargetEligibility( | |
| return { status: 'disabled', disabledReason: goneReason } | ||
| } | ||
|
|
||
| type AgentTargetMenuItemProps = { | ||
| target: NotesSendAgentTarget | ||
| agent: DashboardAgentRowData | null | ||
| now: number | ||
| disabled: boolean | ||
| onSend: (target: NotesSendAgentTarget) => void | ||
| } | ||
|
|
||
| function AgentRowTargetMenuItem( | ||
| props: AgentTargetMenuItemProps & { agent: DashboardAgentRowData } | ||
| ): React.JSX.Element { | ||
| const conversationName = useAgentRowConversationName(props.agent) | ||
| // Same name as the agent's sidebar row, so same-type agents stay distinguishable. | ||
| const name = conversationName ?? getAgentRowPrimaryText(props.agent.entry) | ||
| return <AgentTargetMenuItem {...props} name={name} /> | ||
| } | ||
|
|
||
| function AgentTargetMenuItem({ | ||
| target, | ||
| agent, | ||
| name, | ||
| now, | ||
| disabled, | ||
| onSend | ||
| }: { | ||
| target: NotesSendAgentTarget | ||
| agent: DashboardAgentRowData | null | ||
| now: number | ||
| disabled: boolean | ||
| onSend: (target: NotesSendAgentTarget) => void | ||
| }): React.JSX.Element { | ||
| }: AgentTargetMenuItemProps & { name: string }): React.JSX.Element { | ||
| const tabTitle = target.tabTitle.trim() | ||
| const typeLabel = formatAgentTypeLabel(target.agentType ?? agent?.agentType) | ||
| // Use the sidebar’s display state so failed/stopped agents agree across surfaces. | ||
| const state = agent ? agentRowDisplayDotState(agent) : 'idle' | ||
| const timeAgo = agent ? formatAgentRelativeTime(agent, now) : null | ||
|
|
@@ -271,16 +289,18 @@ function AgentTargetMenuItem({ | |
| ? agentSendDisabledReasonLabel(target.disabledReason) | ||
| : undefined | ||
| const secondaryParts = [ | ||
| ...(name ? [typeLabel] : []), | ||
| agentStateLabel(state), | ||
| ...(timeAgo ? [timeAgo] : []), | ||
| ...(tabTitle ? [tabTitle] : []) | ||
| // Why: unnamed rows keep the raw tab title as their only differentiator. | ||
| ...(!name && tabTitle ? [tabTitle] : []) | ||
| ] | ||
| return ( | ||
| <DropdownMenuItem | ||
| disabled={disabled} | ||
| onSelect={() => onSend(target)} | ||
| // Match dashboard tooltips for permission, stale-state and missing-terminal reasons. | ||
| title={disabledReason} | ||
| // Match dashboard tooltips for disabled reasons; otherwise show the full, possibly truncated, name. | ||
| title={disabledReason ?? (name || undefined)} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| className="min-w-[240px] gap-2 rounded-[7px] px-2 py-1.5 text-[12px] leading-5 font-medium" | ||
| > | ||
| {/* Why: the ancestor's actionable disabled reason must win on every hit area. */} | ||
|
|
@@ -291,10 +311,8 @@ function AgentTargetMenuItem({ | |
| title={disabledReason ? null : undefined} | ||
| /> | ||
| <AgentTypeIcon agentType={target.agentType ?? agent?.agentType} size={14} /> | ||
| <span className="grid min-w-0 flex-1 text-left"> | ||
| <span className="truncate"> | ||
| {formatAgentTypeLabel(target.agentType ?? agent?.agentType)} | ||
| </span> | ||
| <span className="grid max-w-[300px] min-w-0 flex-1 text-left"> | ||
| <span className="truncate">{name || typeLabel}</span> | ||
| <span className="truncate text-[11px] font-normal text-muted-foreground"> | ||
| {secondaryParts.join(' · ')} | ||
| </span> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.