fix(desktop): hide background stop control for SubAgents

This commit is contained in:
程序员阿江(Relakkes) 2026-07-11 05:20:01 +08:00
parent 20bb86ab63
commit 4d23896f39
2 changed files with 3 additions and 4 deletions

View File

@ -310,7 +310,7 @@ describe('SessionActivityPanel', () => {
expect(screen.getByRole('button', { name: 'Stopping background task Sleep for 300 seconds' })).toBeDisabled()
})
it('offers the same stop control for a running background SubAgent', () => {
it('does not offer the background task stop control for a running SubAgent', () => {
const onStopBackgroundTask = vi.fn()
render(
<SessionActivityPanel
@ -341,8 +341,7 @@ describe('SessionActivityPanel', () => {
/>,
)
fireEvent.click(screen.getByRole('button', { name: 'Stop background task Background reviewer' }))
expect(onStopBackgroundTask).toHaveBeenCalledWith('agent-task-1')
expect(screen.queryByRole('button', { name: 'Stop background task Background reviewer' })).not.toBeInTheDocument()
})
it('keeps SubAgent rows to name and status instead of result previews', () => {

View File

@ -351,7 +351,7 @@ function ActivityRowView({
)
const interactiveRowClassName =
'flex min-w-0 items-center gap-2.5 rounded-lg px-2.5 py-2.5 text-left transition-[background-color,transform] duration-150 ease-out hover:bg-[var(--color-surface-hover)] active:translate-y-px focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-border-focus)]'
const stopButton = onStopBackgroundTask ? (
const stopButton = row.section === 'backgroundTasks' && onStopBackgroundTask ? (
<BackgroundTaskStopButton
row={row}
stopping={Boolean(stoppingBackgroundTask)}