Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,32 @@ describe('BackgroundTasksDialog', () => {
expect(h.cancel).toHaveBeenCalledWith('bg-1');
});

it('drops the [in turn] prefix on settled foreground rows', () => {
// The prefix exists to warn users that cancelling will end the parent's
// turn. Once the entry is terminal there is nothing to cancel, so the
// warning would just be noise alongside the dimmed-row presentation.
const running = entry({
agentId: 'fg-running',
status: 'running',
flavor: 'foreground',
description: 'still going',
});
const completed = entry({
agentId: 'fg-done',
status: 'completed',
flavor: 'foreground',
description: 'finished work',
});
const h = setup([running, completed]);
h.call(() => h.probe.current!.actions.openDialog());

const frame = h.lastFrame() ?? '';
expect(frame).toContain('[in turn] still going');
// The settled row keeps the description but loses the prefix.
expect(frame).toContain('finished work');
expect(frame).not.toContain('[in turn] finished work');
});

it('ignores `x` on a terminal foreground entry (no arm, no cancel call)', () => {
// A foreground entry briefly stays visible after settling but before
// the tool-call's finally path unregisters it. The dialog's hint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,19 @@ function terminalStatusPresentation(
}
}

// Foreground agent rows get this prefix so users can tell at a glance
// that cancelling one will end the parent's current turn — a much heavier
// consequence than cancelling a truly async background entry.
// Live foreground rows get this prefix to warn the user that cancelling
// one ends the parent's current turn — a much heavier consequence than
// cancelling a truly async background entry. Settled foreground rows
// drop the prefix because there's nothing left to cancel.
const FOREGROUND_ROW_PREFIX = '[in turn]';
const SHELL_ROW_PREFIX = '[shell]';

function rowLabel(entry: DialogEntry): string {
switch (entry.kind) {
case 'agent': {
const label = buildBackgroundEntryLabel(entry, { includePrefix: false });
return entry.flavor === 'foreground'
const isLive = entry.status === 'running' || entry.status === 'paused';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[Suggestion] Variable name isLive is ambiguous.

The core BackgroundTaskRegistry consistently uses "terminal" / "non-terminal" terminology. isLive has no precedent in the codebase and could be misread as "row is currently rendered in the dialog" rather than "execution is active". isActive or isNonTerminal would be clearer.

Suggested change
const isLive = entry.status === 'running' || entry.status === 'paused';
const isActive = entry.status === 'running' || entry.status === 'paused';
return entry.flavor === 'foreground' && isActive

— deepseek-v4-pro via Qwen Code /review

return entry.flavor === 'foreground' && isLive
? `${FOREGROUND_ROW_PREFIX} ${label}`
: label;
}
Expand Down
Loading