fix(sidebar): attribute spinner-only pane titles to the launched agent (#9647)
* fix(sidebar): attribute spinner-only pane titles to the launched agent A braille-spinner terminal title proves activity but carries no agent identity, so the title-derived sidebar row resolver dropped it. Agents without working status hooks — Codex over SSH (#8711) — only ever emit spinner+cwd titles, so their worktrees showed no agent row at all while Claude (hook-backed) rows appeared. Fall back to the tab's launch identity (tab.launchAgent) for spinner-only titles, mirroring the precedence the hook-row path already uses. Explicit title identity still wins, Claude-specific prefixes (✳ / '. ' / '* ') are unaffected, and panes without launch metadata keep the existing no-row behavior. * test(sidebar): pin spinner fallback no-launchAgent gate; note split-pane residual Adds a regression test asserting a spinner-only title with no tab launch identity produces no row, pinning the `launchAgent ?? null` gate that the two existing tests do not exercise. Expands the fallback comment to record why it is spinner-gated (vs the hook path's unconditional launchAgent fallback) and the split-pane braille-title residual. Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -201,6 +201,60 @@ describe('buildTitleDerivedAgentRows', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('attributes a spinner-only title to the launched agent when the title has no identity', () => {
|
||||
const launchAgent: TuiAgent = 'codex'
|
||||
const rows = buildWorktreeAgentRows({
|
||||
tabs: [makeTab('tab-1', { launchAgent })],
|
||||
entries: [],
|
||||
retained: [],
|
||||
runtimePaneTitlesByTabId: {
|
||||
// Codex over SSH emits spinner + cwd titles with no agent name (#8711).
|
||||
'tab-1': { 1: '⠼ demo-repo' }
|
||||
},
|
||||
ptyIdsByTabId: { 'tab-1': ['pty-codex-remote'] },
|
||||
terminalLayoutsByTabId: { 'tab-1': makeSingleLayout(LEAF_ID_1) },
|
||||
now: 2000
|
||||
})
|
||||
|
||||
expect(
|
||||
rows.map((row) => [row.agentType, row.state, row.entry.prompt, row.entry.terminalTitle])
|
||||
).toEqual([['codex', 'working', 'Codex', '⠼ demo-repo']])
|
||||
})
|
||||
|
||||
it('keeps explicit title identity over the launched agent', () => {
|
||||
const launchAgent: TuiAgent = 'claude'
|
||||
const rows = buildWorktreeAgentRows({
|
||||
tabs: [makeTab('tab-1', { launchAgent })],
|
||||
entries: [],
|
||||
retained: [],
|
||||
runtimePaneTitlesByTabId: {
|
||||
'tab-1': { 1: '⠋ Codex' }
|
||||
},
|
||||
ptyIdsByTabId: { 'tab-1': ['pty-explicit'] },
|
||||
terminalLayoutsByTabId: { 'tab-1': makeSingleLayout(LEAF_ID_1) },
|
||||
now: 2000
|
||||
})
|
||||
|
||||
expect(rows.map((row) => [row.agentType, row.state])).toEqual([['codex', 'working']])
|
||||
})
|
||||
|
||||
it('produces no row for a spinner-only title when the tab has no launch identity', () => {
|
||||
const rows = buildWorktreeAgentRows({
|
||||
tabs: [makeTab('tab-1')],
|
||||
entries: [],
|
||||
retained: [],
|
||||
runtimePaneTitlesByTabId: {
|
||||
// Spinner activity but no identity and no launchAgent to attribute it to.
|
||||
'tab-1': { 1: '⠼ demo-repo' }
|
||||
},
|
||||
ptyIdsByTabId: { 'tab-1': ['pty-anon'] },
|
||||
terminalLayoutsByTabId: { 'tab-1': makeSingleLayout(LEAF_ID_1) },
|
||||
now: 2000
|
||||
})
|
||||
|
||||
expect(rows).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('does not turn generic Codex-launched task titles into Claude Code rows', () => {
|
||||
const launchAgent: TuiAgent = 'codex'
|
||||
const rows = buildWorktreeAgentRows({
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { DashboardAgentRow } from '@/components/dashboard/useDashboardData'
|
||||
import { isClaudeManagementTitle } from '@/lib/agent-status'
|
||||
import { formatAgentTypeLabel, isClaudeManagementTitle } from '@/lib/agent-status'
|
||||
import { containsBrailleSpinner } from '../../../../shared/agent-title-core'
|
||||
import { classifyTitleActivity, resolveTitleActivityLabel } from '@/lib/pane-agent-evidence'
|
||||
import { tabHasLivePty } from '@/lib/tab-has-live-pty'
|
||||
import type {
|
||||
@@ -142,10 +143,20 @@ function buildTitleDerivedAgentRow(args: {
|
||||
}
|
||||
const paneKey = makePaneKey(args.tab.id, args.leafId)
|
||||
const orchestration = args.runtimeAgentOrchestrationByPaneKey?.[paneKey]
|
||||
const agentType = isClaudeAgentsTitle ? 'claude' : resolveTitleDerivedAgentType(title, label)
|
||||
const titleAgentType = isClaudeAgentsTitle ? 'claude' : resolveTitleDerivedAgentType(title, label)
|
||||
// Why: a braille spinner proves activity, not identity, so the resolver drops
|
||||
// it. Hook-less agents over SSH (Codex, #8711) surface only spinner+cwd titles;
|
||||
// fall back to the tab's launch identity instead of hiding the pane. Gated on
|
||||
// the spinner on purpose — unlike the hook path's unconditional launchAgent
|
||||
// fallback (resolveRowAgentType), this path manufactures agent-ness from a
|
||||
// title alone, so a non-agent title must never become a row. Residual: a split
|
||||
// pane whose own title carries a braille glyph is still attributed to launchAgent.
|
||||
const agentType =
|
||||
titleAgentType ?? (containsBrailleSpinner(title) ? (args.tab.launchAgent ?? null) : null)
|
||||
if (!agentType) {
|
||||
return null
|
||||
}
|
||||
const rowLabel = titleAgentType ? label : formatAgentTypeLabel(agentType)
|
||||
const rowState = titleStatusToRowState(status)
|
||||
const secondary =
|
||||
status === 'permission' ? 'Needs input' : status === 'working' ? 'Running' : 'Idle'
|
||||
@@ -153,7 +164,7 @@ function buildTitleDerivedAgentRow(args: {
|
||||
const entry: AgentStatusEntry = {
|
||||
paneKey,
|
||||
state: entryState,
|
||||
prompt: label,
|
||||
prompt: rowLabel,
|
||||
updatedAt: args.now,
|
||||
stateStartedAt: args.now,
|
||||
stateHistory: [],
|
||||
|
||||
Reference in New Issue
Block a user